On 2/6/2023 16:47, Ken Cunningham wrote:

You have probably already noted that which and type are both built in to the 
default zsh on Ventura and as far as I can tell from my testing here give 
identical results in every case. Both correctly predict the binary that will be 
executed in every case I tried.

Indeed, zsh is a bit special and implements both 'which' and 'type' in terms of its 'whence' builtin (which has a lot of options and can tell you pretty much anything you would ever want to know about a command's disposition, check it out.) You will notice /usr/bin/which can thus give different results to just 'which'.

What will happen when you add and remove binaries from an upstream PATH folder 
is a bit difficult to predict accurately. I won't try to summarize the findings 
only to have someone point out their idea of an exception, but it's fair to say 
that it's best to open a new shell to get predictable results.

You would want to start a new shell if you changed the startup files. Otherwise 'hash -r' is quite sufficient. Changing the value of PATH at runtime will do that automatically in modern shells, BTW.

- Josh

Reply via email to