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

Re: Sub-folders in $PATH?



03.07.2016, 01:16, "TJ Luoma" <luomat@xxxxxxxxx>:
> Is there an option to have subfolders in a $PATH folder searched as well?
>
> For example, if I wanted to put some folders in /usr/local/bin/scripts/
> without explicitly adding /usr/local/bin/scripts/ to $PATH
> (assuming /usr/local/bin/ was already in there).
>
> TJ

If script names are unique you may employ command_not_found_handler function to do this job. Note though that this will work like you have all subfolders after all folders in $PATH, if e.g. there are executables `/usr/bin/scripts/foo` and `/usr/local/bin/foo` and `PATH=/usr/bin:/usr/local/bin` then implementing this functionality via command_not_found_handler will find `/usr/local/bin/foo` before considering `/usr/bin/scripts/foo`.



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