Harumph. I had suspected DOS line endings. I should've mentioned the possibility in my last post.
And just to clarify:
As I said before, /bin/sh
is the posix-defined
system shell. In the early days this was pretty much synonymous with the original bourne shell, but these days its functions are usually supplied by another shell, bash
, among others.
But be aware that, even if another shell is used for sh
, the script will be interpreted strictly according to posix standards. This can sometimes have confusing effects. Code that is written according to the standard will run correctly, code that conflicts with it will cause it to error out, and code that is undefined
by the standard may either run or not, according to whether the shell used supports that specific feature.
Arrays are a common example. They are not part of posix, and if you use them in a /bin/sh
script, they will work if the underlying shell is bash
, but will fail if it's dash
, since that shell doesn't support arrays.