zsh does not find script in PATH while bash does (echo $PATH is the same)
Don't use ~
in your PATH
. It's a shell shorthand for your home directory, but it won't work in a lot of other cases. The cases where it does work properly are those where the shell expands it into the full path to your home directory before it's actually used. Also, don't put a /
at the end of a PATH
entry.
So this is ok, because the shell will expand it before it's added to PATH
:
PATH="$PATH":~/bin
The shell will expand the ~
to something like /Users/stochastik3
, and that'll be added to the PATH
variable. But if you use this:
PATH="$PATH:~/bin" # Don't do this
The ~
is inside double-quotes, so it won't expand properly.
Now, the reason that it works in bash is that bash does its own PATH
interpretation, and it does expand ~
when it finds it in PATH
. But nothing else does. zsh doesn't, ksh doesn't, and probably more importantly the OS doesn't, so a PATH
entry with ~
won't be recognized in a find ... -exec
, or sudo
, or env
, or... anything other than directly in bash.