This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: bash/sh program interpreter problems...


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]