Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Message-ID: <417D19BB.6090101@x-ray.at> Date: Mon, 25 Oct 2004 17:20:27 +0200 From: Reini Urban User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; de-AT; rv:1.8a3) Gecko/20040817 MIME-Version: 1.0 To: Robert Schmidt CC: cygwin AT cygwin DOT com Subject: Re: bash/sh program interpreter problems... References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Robert Schmidt schrieb: > I have the following two programs in /usr/local/bin: > > --- test.btm > #!/usr/local/bin/testint.sh > echo hello from test.btm naming a shell script .btm is not a good idea, since .btm files are usually 4NT batch files. same for .h files. windows has some internal registry key which extensions are executable. > --- testint.sh > #!/bin/sh > echo hello from test interpreter. the file is "$1" > > --- test.h > #!/bin/bash > test.btm chmod +x /usr/local/bin/test.btm chmod +x /usr/local/bin/test.h does the explicit path help? --- test.h #!/bin/bash /usr/local/bin/test.btm One should not assume that test.btm is executable. BTW: I have the same problems, with some php or java wrappers. The first call gives this error message "bad interpreter", the seconds works fine then. > Then I do this: > > ~ $ echo $PATH > /usr/bin:/usr/local/bin:/cygdrive/c/WINDOWS/system32:/cygdrive/c/WINDOWS:...[snip] > > ~ $ test.btm > : bad interpreter: No such file or directoryn/testint.sh > ~ $ > > First of all, the output is messed up by an ASCII 13 character. Putting > an extra space after "testint.sh" in test.btm fixes this. I don't > understand why this problem doesn't occur for /bin/sh or /bin/bash > interpreter specifications. > > ~ $ test.btm > bash: /usr/local/bin/test.btm: /usr/local/bin/testint.sh: bad > interpreter: No such file or directory > > Second, I can't figure out why testint.sh is not found. Further testing > shows that the result is highly dependent on the current working > directory, and almost inexplicably random. test.sh seems to fail much > more often then simply test.btm. > The scripts were initially DOS ASCII. Converting them with dos2unix > only takes away the first problem above. All mounts are binmode. > Here are a few more runs: > > ~ $ cd /usr/local/bin > /usr/local/bin $ test.btm > hello from test interpreter. the file is /usr/local/bin/test.btm > /usr/local/bin $ test.sh > /usr/local/bin/test.sh: /usr/local/bin/test.btm: > /usr/local/bin/testint.sh: bad interpreter: No such > file or directory > /usr/local/bin $ test.btm -- Reini Urban http://xarch.tu-graz.ac.at/home/rurban/ -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/