Newbie Questions

Andrey Repin anrdaemon@yandex.ru
Wed Feb 5 22:20:00 GMT 2014


Greetings, Warren Young!

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

Not necessarily. Especially not, when using ShellExecute(Ex)?...

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

Have you actually tried that?
Try it, you'll be surprised.

> 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().

Try it yourself... you'll be surprised.


--
WBR,
Andrey Repin (anrdaemon@yandex.ru) 06.02.2014, <02:02>

Sorry for my terrible english...


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