From: cgf@cygnus.com (Christopher G. Faylor)
Subject: Re: #!/bin/sh troubles
29 Dec 1998 01:53:15 GMT
Message-ID: <769cmb$rm5$1@cronkite.cygnus.com>
References: <Pine.LNX.4.05.9812071345480.22256-100000@cseawood.qualcomm.com> <Pine.LNX.4.05.9812281449390.3134-100000.cygnus.gnu-win32@cseawood.qualcomm.com>
X-Newsreader: trn 4.0-test63 (15 March 1998)

In article <Pine.LNX.4.05.9812281449390.3134-100000.cygnus.gnu-win32@cseawood.qualcomm.com>,
Christopher Seawood <cseawood@qualcomm.com> wrote:
>On Mon, 7 Dec 1998, it was written:
>> I copied b20.1's sh.exe to /bin/sh and cp removed the execute permissions.
>> Chmod'ing the binary did not work either.  So I moved /bin/sh to 
>> /bin/sh.exe.  Autoconf runs and spits 6 lines of control chars, each
>> ending with ": not found".  Then it spits out
>>      /bin/sh.exe: 11: Syntax error: ")" unexpected.  
>> 
>
>Well, I was playing with the problem again today when I accidentally
>typed:  sh /bin/sh.exe .  And surprise, I got the same 6 lines of control
>chars so could it be that sh is attempting to run itself instead of the
>shell script that calls it when I try to run just ./configure or autoconf?

The standard Windows permission settings do not include an execute bit.
The execute bit is simulated by Cygwin.  If Cygwin sees that a filename
ends with .exe, it sets the execute permission bits that you see when
you do a ls -l.  Cygwin will also set the bits if the first two characters
of a file are '#!'.

I'm not sure why you're copying /bin/sh.exe to /bin/sh but it is not
necessary and will only confuse things.

Scripts that begin with '#!/bin/sh' behave properly under Cygwin.  Adding
the .exe to the /bin/sh is optional and probably should be avoided if your
goal is to create portable scripts.

-- 
cgf@cygnus.com
http://www.cygnus.com/
