I guess I never realized that, when it comes to options, there is a difference between running a script directly and passing it as an argument to zsh.
But even still, If I do this:
> echo $PATH
/usr/bin:./dir
> ls dir
-rwxr--r-- 1 root root 9 Jan 26 03:26 foo.zsh
> setopt pathscript
> zsh foo.zsh
zsh: can't open input file: foo.zsh
> unsetopt pathscript
> zsh foo.zsh
zsh: can't open input file: foo.zsh
So I’m still seeing no difference between execution of the script with path script on or off in these cases.
HOWEVER, I discovered if I put this in my .zshrc:
setopt pathscript
and do:
> zsh -i foo.zsh
It works.
Or, if I do
> setopt pathscript
and then do
> zsh -c foo.zsh
This also works.
> zsh -i foo.zsh wil also work in this case, too.