For an interactive shell, pick your poison. A long time ago I knew somebody who used /bin/ed as his primary user interface, using ed's "!command" to execute shell commands (a mechanism to manage the history of Bourne shell commands on V7 Unix).
I generally want the shell scripts I write to work universally. So portability is a really big issue.
For scripts used in the "early boot" context you may be constrained to use
/bin/sh
. My experience is that
/bin/sh
will struggle with full POSIX compliance on just about any Unix/Linux variant you name. For me, this certainly includes:
- FreeBSD /bin/sh;
- Debian /bin/sh (dash);
- RedHat /bin/sh (bash, but behaves differently due to its invocation name);
The common denominator with these is not POSIX. It's the "Bourne shell". e.g. older versions of dash can't catch stdout with "$(command)".
So for "early boot" scripts, I use Bourne shell. However, I reckon that few people really understand exactly what a Bourne shell is today.
Outside the "early boot" process, I still want portability. My own rule is that as soon as I think I need non-Bourne syntax, I switch to perl (substitute python if you're younger than me).
That will generally happen because I really need an array of some kind, or serious use of regex (without fork and exec).
However, it's OK to use the specific local shell if portability is maintained, e.g. iptables or LVM scripting must be on Linux, so bash is OK.
If speed matters, ksh is pretty lean and mean, bash is an absolute dog, and perl rocks.