Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Can't tell the difference in operation between PATH_SCRIPT and NO_PATH_SCRIPT



On Fri, Jan 26, 2024, at 12:20 AM, Steve Dondley wrote:
> OK, thanks.
>
> At the risk of dragging this on, allow me to ask this simple question 
> to make sure I got it:
>
> Is there any way to run this command by itself on the command line:
>
>> setopt pathscript
>
> And have it affect the outcome of any subsequent commands? It looks 
> like the answer is no.

Correct.  It does not affect regular command execution (and is not
intended to).


> It looks to me like the pathscript setting can only affect future 
> commands if it’s either:
>
> a) used with +o or -o as part of an argument passed directly to zsh 
> while running a script
> b) or if it’s set in a .zshrc file (or other config file) and then 
> sourced when a new shell (interactive mode)

Those are two ways to enable PATH_SEARCH for a new zsh process,
sure.  Bart listed some more.

But "affecting future commands" is not really the way to look at
it; the option is not that general.  PATH_SCRIPT affects one very
specific behavior: whether or not ''zsh foo'' searches PATH for a
script "foo" if ./foo doesn't exist.  It does not affect anything
else, including PATH search *within* that script.

Probably should have asked earlier, but:  What were you trying to
achieve with PATH_SEARCH, exactly?


-- 
vq




Messages sorted by: Reverse Date, Date, Thread, Author