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

Re: Can $PATH look into sub-folders?



> On 25 August 2021 at 15:17 TJ Luoma <luomat@xxxxxxxxx> wrote:
> It is my understanding the zsh (and others) do not usually look into
> sub-folders of $PATH for commands.
> 
> For example, if /usr/local/bin/ is in my $PATH and I have a folder
> /usr/local/bin/private/ then zsh would not ‘see’ any scripts/utilities/etc
> that were in /usr/local/bin/private/ unless I specifically added
> /usr/local/bin/private/ to my $PATH.
> 
> That seems to be my experience, at least.
> 
> My question is whether or not there is an option (a zsh-specific option is
> fine) which would tell zsh to include sub-folders of $PATH folders without
> having to explicitly add them all to $PATH.

The only choices I can see are:

Firstly, set the PATH_DIRS option and refer to them by relative path, i.e.
private/...

Secondly, use recursive globbing to add the directories to path, so at
least you don't need to do that explicitly.  In other words,

path+=(/usr/local/bin/**/*(/))

pws




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