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: Newbie Questions


Greetings, Warren Young!

> On 2/5/2014 15:07, Andrey Repin wrote:
>>
>>> 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?

> Yep.

>> Try it, you'll be surprised.

> I did try it, before sending the previous message pair.

> Save the attached file as foo.sh, then run it with "bash foo.sh", rather 
> than "./foo.sh".  This is what happens when you associate *.sh with 
> bash.exe in Windows Explorer.

[C:\home\Daemon]$ bash -c ./foo.sh
Hello from Perl!

[C:\home\Daemon]$

> Bash tries to interpret the file as a shell script, despite the shebang 
> line.  This is because Bash doesn't do the shebang handling, exec() 
> does, and Bash treats passed file names as names of shell scripts.  It 
> runs them directly, not through exec().

Perhaps, we have different bash'es...


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

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


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