This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: Newbie Questions
- From: Warren Young <warren at etr-usa dot com>
- To: cygwin at cygwin dot com
- Date: Wed, 05 Feb 2014 14:30:44 -0700
- Subject: Re: Newbie Questions
- Authentication-results: sourceware.org; auth=none
- References: <1898639722 dot 6893470 dot 1391541591920 dot JavaMail dot root at ptd dot net> <52F153AE dot 5080704 at gmail dot com> <52F28215 dot 5030801 at ptd dot net> <52F28330 dot 6060101 at cygwin dot com> <52F2AA5D dot 4000000 at etr-usa dot com>
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