From: Keith MARSHALL <keith.marshall@to...> - 2005-10-17 09:12:45
John Vandenberg wrote, quoting Andrew Crosher:
>> Hello all,
>> The first few lines of the script im trying to run are as follows:
> This could be your problem. msys distributes bash as /bin/sh .
John just beat me to giving an almost identical answer :-)
Indeed, this WILL induce the symptom that Andrew reports; that shebang
line must be written as `#! /bin/sh', to get any shell script to run in
MSYS. (The space is optional -- I like to add it because some BSD shells
are REPORTED to require it, although none actually seems to exhibit this
As a general guideline, when writing shell scripts which you may wish to
run on more than one platform:--
1) ALWAYS write for the lowest common denominator of Bourne shell
capability and features.
2) ALWAYS write the shebang as `#! /bin/sh', UNLESS you specifically
require some advanced feature of another shell; (and you should
try to avaoid this). (The rationale for this is that every UNIX
system under the sun has /bin/sh, and this is required by POSIX,
whereas the other shells are strictly optional, so you cannot
rely on their existence on any target system).