Switched to Bash and Comparison of Shells

Jerry freebsd.user at seibercom.net
Thu Jun 10 19:15:51 UTC 2010


On Thu, 10 Jun 2010 13:41:32 -0400
Lowell Gilbert <freebsd-questions-local at be-well.ilk.org> articulated:

> bash (like most other sh-style shells) has no "which" builtin.  You
> end up running /usr/bin/which.  bash (like most other sh-style
> shells) does have a (rough) equivalent, which is "type"

Personally, I have found the "command" equivalent quite adequate. I use
a version of the following in all of my Bash scripts that require
checking for the presents of another program.

command -v command1 >/dev/null && echo "command1 Found In \$PATH" || echo "command1 Not Found in \$PATH"

-- 
Jerry
FreeBSD.user at seibercom.net

Disclaimer: off-list followups get on-list replies or get ignored.
Please do not ignore the Reply-To header.
__________________________________________________________________

Sure you can trust the Government; ask any Indian.


More information about the freebsd-questions mailing list