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]

Fun with #! (aka shebang) and filenames ending in .exe


Try this:
cat > foo.sh <<EOF
#!/bin/sh
echo Howdy
EOF
chmod +x foo.sh
./foo.sh
mv foo.sh foo.exe
./foo.exe

The first foo.sh works fine.  The second... well, it's entertaining.
I have to kill the window, ^C is ignored.

Now, I know one shouldn't do nasty tricks like that, but
I ran into it very innocently.  I was trying to make a distcc
masquerade directory on cygwin; my technique has been to
create shell scripts with the same name as the real app
that set a few variables and run a different app with the
original commandline as arguments.  On cygwin, the original
app was named something.exe, so using my usual technique, I
created a shell script named something.exe, and kerblooie!

Anyway, it'll probably work just fine to name my shell script
without the suffix, but I just wanted to send a postcard
from filename hack hell :-)

- Dan


--
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]