This is the mail archive of the cygwin@sourceware.cygnus.com 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]

Re: How to make a shell script runnable?


Hi Wei Xiang,

on Wed, 2 Sep 1998 09:44:01 +0800 , you wrote:

> I am using B19 in Windows 98 platform.  But I can not use the chmod command
> to change a file's attributes.  Why?  Your suggestion will be very helpful
> to me.

DOS/Windows file systems don't have "executable" attributes, and so
Cygnus/bash has to guess whether a file is executable or not.
`chmod´ doesn't set some magic (hidden in a file or so) executable
attribute, it can only be used to set the "writable" bits ("not
read-only" in DOS terms).

Bash executes everything, whether it shows up as "executable" in `ls -l´
or not. It knows about popular file extensions like .exe or .com (not
.bat, maybe some others, I don't know). And bash also knows about the
so-called she-bang syntax: if you put a #! in the first line and first
column of your script, bash will call the interpreter denoted after the
"#!" (e.g. you could use "#!/bin/sh" or "#!/bin/perl"). For files with
that "#!" in the first two bytes, `ls -l´ will display the executable
flag.

Note that on Unix (and therefore Cygnus), the search PATH for
executables doesn't include the current directory automatically, like on
DOS. So if you want to run a program "a" in the current directory, you
have to explicitly say "./a", not just "a".

Regards...
		Michael
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".


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