The Problem
It is common for students to have portability problems with their scripts when they do their initial development on systems that use bash, for example, as /bin/sh. While bash supports all functionality in the POSIX standard, it also supports a wide range of extended functionality that is not defined by POSIX. When a script is written to use such 'bashisms', it is not guaranteed to run correctly when /bin/sh is some other POSIX compliant shell. On nice.harvard.edu, which is an Ubuntu system, /bin/sh is dash, a shell that runs much faster than bash, but does not support functionality beyond that specified by the POSIX standard. Students who have used 'bashisms' in their scripts discover, often at the last minute, that their scripts will not run under /bin/sh on nice.
The Solution
Here are a few tips to help you avoid such problems:
- always develop scripts on nice with /bin/sh if possible
- install a strict POSIX shell (such as dash) on your personal system for development purposes
- only use functionality specified here when
developing shell scripts
- view this document to get tips on
recognizing and replacing 'bashisms'
- view the full documentation for
autoconf ('info autoconf.info'), which has a good section on
'Portable Shell' programming
See this for more information.