Shell scripting and system administration

Some useful programs for use in shell scripts and general system administration tasks:

Bash scripting idioms

General sh-type script tips

Portable sh-type scripts

A while ago, I was responsible for a rather complex script which had to be sourced (rather than just executed) by bash, sh, ksh and zsh shells recently and it turned out to be a bit of a nightmare to make it compliant. I'll put some pointers here as I remember them. More recently, I was doing a lot of work using the GNU automake and autoconf packages. For maximum portability across systems, again a very portable base of sh constructs is allowed: the 1977 subset of sh if I remember rightly! The autoconf documentation has a comprehensive section on writing portable sh scripts in the context of autoconf M4 macros.