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

Command wrappers in $PATH, and re-executing the "correct" value



I find that very frequently I write a wrapper for some CLI tool, say "foobar".

Let's say lives at e.g. /usr/local/bin/foobar, and $path is ( ... ~/bin ... /usr/local/bin ).

I have a wrapper script ~/bin/foobar, which will be invoked for the command "foobar".  What my wrapper script does is immaterial, but it eventually executes the /usr/local/bin/foobar with some set of arguments.

As best I can tell, there are three ways to make this work neatly:
I've already adopted autoloadable functions via $fpath and using "command foobar" inside the function, but I was curious if there's another way.  I expect that removing ${0:h} and ${0:A:h} from $path are the most obvious answers, but I didn't know if there's anything easier.

Zach Riggle


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