On Sat, 2010-05-22 at 10:35 +0200, Nicolas Richard wrote:
> Also on bash, the builtin "type" seems to do the job of 'alias' and
> 'which' at the same time. Is there any drawback to using that one ?

Certainly not for an interactive shell - since it's a bash builtin,
it'll tell you *exactly* what bash will do if you try to run the command
you ask it about. Particularly useful with the '-a' flag, which tells it
to list all matching commands, not just the first one. For example:

$ type -a ls
ls is aliased to `ls --color=auto'
ls is /bin/ls

Maybe in scripting, it might be a problem - if nothing else, it's bash
specific, so shouldn't be used if you're targeting generic 'sh'. You
might also want to use one of the parameters to force it to ignore
anything but actual executables (i.e excluding builtins, aliases,
functions).

Simon.

Attachment: signature.asc
Description: This is a digitally signed message part

-- 
http://linuxfromscratch.org/mailman/listinfo/blfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Reply via email to