How to raise and take care of shell scripts: shell differences
Differences between the various shells
Think carefully, on which systems and shells your script should be executable. The Bourne Again Shell (bash) actually should be installed on every Linux machine. That could be different on commercial unix systems. Meanwhile you should find it there too, but it's not sure and you don't know, if it's the default shell. On those systems you'll find almost everytime the Korn-Shell (ksh). The bash offers you a bunch of faetures, which are not available in other shells. To be on the safe side, look for a compatible solution. You could test your scripts, for example using the Public Domain Korn-Shell (pdksh), which is part of many Linux distributions. Here are some simple examples for such differences:
# command substitution # bash specific DATE=$(date) # all shells: DATE=`date` # variable export # only bash and ksh: export PATH=/home/jan # all shells: PATH=/home/jan export PATH
Update: Just recently I read a Korn shell manual page on a Solaris10 system. It seems, that in the meanwhile some of the bash capabilities are available in this shell too: I found the bash command substitution of my first example there.