[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

which vs. type, and recursion?



Greg Wooledge pointed out in another thread that 'type' is often better than 'which' for finding out what kind of command you're about to run, and where it comes from.

A quick test, however, threw up another issue:

richard@zircon:~$ type ls
ls is aliased to `ls --color=auto'

Great, so it's an alias. But what is the underlying ls? How do I find out? I did find out, by unaliasing ls and trying again, which showed that it's an actual executable, /usr/bin/ls, and not a shell builtin.

But is there an easier/better way? Can 'type' be asked to recursively decode aliases?

I looked at the relevant section of bash(1) (when I eventually found it), but was not particularly enlightened.

Cheers,
Richard


Reply to: