Jacoby Hickerson wrote: > Although, I am curious, is this is a matter of sh being continually > updated to exclude all bash extensions or perhaps previously bash > didn't interpret #!/bin/sh to be the POSIX compliant interpreter?
When bash is invoked as sh then bash complies with the POSIX sh. That is both required and desired. On some GNU/Linux systems /bin/sh is a symlink to /bin/bash and bash will support running as a POSIX sh. But this isn't universal. On other systems /bin/sh is an actual native POSIX sh, on others it is a symlink to /bin/ksh or /bin/zsh or /bin/dash or others. But in all cases /bin/sh is supposed to be a POSIX sh and conform to the standard. Bash tries to be compliant but some differences will creep in regardless. Doing so may cause problems for people who unknowingly use features on one system that are not available on other systems. Generally the wisdom of years is not to be generous in what you accept but to be strict in what you accept. It makes portability easier. Having found that the bash specific feature isn't available in /bin/sh this is a good thing for you since now your script will either need to specify that it needs bash explicitly or you could use portable only constructs and continue to use /bin/sh. Personally I use bash for my command line but /bin/sh and portable constructs for shell scripts. Bob