Monday, July 7, 2014

which and alias: which doesn't consider aliases......use type not which

Have you notive that "which cmd" doesn't give your alias path if cmd is in your aliases?

Aliases are checked before paths when you try to run a cmd in a prompt but which doesn't consider aliases. Which search for the cmd in your paths. If cmd is in your path, you will be confused and you might turn crazy as I close did.

Use type instead of which.

usage: which [options] [--] COMMAND [...]
             Write the full path of COMMAND(s) to standard output.

usage: type [-aftpP] name [name ...]
With no options, indicate how each name would be interpreted if used as a command name

No comments:

Post a Comment