[X-Unix] The which command lies?

Michael Ludwig michael.ludwig at xing.com
Tue Feb 16 01:39:26 PST 2010


Am 16.02.2010 um 04:01 schrieb Steve Morris:

> `which perl` -e 'print "@INC\n";'
>  perl -e 'print "@INC\n";'

Is perl now an alias? Try:

  alias perl

> Instead these commands gave me totally different results indicating two different installations of perl. It turns out that my redirections were working but "which" wasn't seeing them.

Try the type built-in bash command:

  type perl    # help type

The which command searches the PATH. After installation of a new utility,
the PATH may need to be updated. This can be done using the hash built-in
bash command.

  hash -r      # help hash
  type perl

> What the heck is wrong with the "which" command on OSX? Why do "bash" and "which" disagree on the actual path of the command to run? What is the point of having a "which" command if it doesn't match.

It may turn out that which works as specified.

-- 
Michael.Ludwig (#) XING.com



More information about the X-Unix mailing list