Bourne to Bourne Again Shell Forward Compatibility

(Preliminary) Conclusion

First a disclaimer: The forward-incompatibilities presented in this article are very likely not exhaustive.

Scripts, even if adhering to the strictest possible conformance to Bourne Shell language, can encounter problems when run in Bourne Again Shell. Some of the problems will be very apparent (as shown, throwing syntax errors), while others could be more subtle (as shown, main program global variables not modified as expected).

An aspect not covered in detail by this article is, that there exist variations and derivations of Bourne Shell that at the one hand claim „Bourne Shell compatibility“ but offer additional constructs that do not appear in Bourne Shell and are not implemented (or implemented differently) in Bourne Again Shell. For example, how to port Korn Shell co-processes to Bash is out of scope. A baseline feature set that can be tested against are the POSIX requirements, but these are based on a historical version of Korn Shell, not genuine Bourne Shell and can not cover all differences.

As far as this treatise reaches, if sound practices of quoting literals and naming functions and variables have been applied, and no assumptions about sub-processing pipeline components have been made, Bourne Shell script code will be forward-compatible to Bourne Again Shell.