Sometimes - perhaps often - you are in situations where you have no control over the shell, in these cases writing "portable" shell scripts is helpful.
I have been enjoying "Beginning Portable Shell Scripting"[0] by Peter Seebach for this very reason.