Newbie Questions

Warren Young warren@etr-usa.com
Wed Feb 5 21:30:00 GMT 2014


On 2/5/2014 14:17, Warren Young wrote:
>
> I'd bet there are more Bourne shell scripts in the world with no
> extension at all than .sh.

....That said, if you're wanting to be able to double-click on a shell 
script icon in Windows and associate that with Cygwin's bash.exe, you 
*will* need to pick a file name extension, since that's how Windows 
determines what's in a file.

.sh is indeed the standard choice when you must use a file extension for 
a Bourne shell script, for whatever reason.

These two features can interact in odd ways.

Say you have a Perl script, which you have misleadingly named foo.sh. 
 From a bash shell, you type:

	$ ./foo.sh

The Perl script will run as intended, despite the name.

But if you associate .sh with bash.exe, then double-click that script 
from Windows Explorer, it won't work right, since bash.exe will try to 
run it as a shell script.  Perl isn't close enough in syntax to Bourne 
shell for this to work for anything but trivial (or very tricky!) scripts.

What you've done here is substitute Windows Explorer for exec(), so you 
don't get the shebang handling built into exec().

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list