Shell scripts starting with "#"
Paul Davey
pd at x.co.uk
Wed Oct 10 12:56:35 AEST 1990
[Moderators Note:-
To save a deluge of mail and postings, the answer is to
put a ':' by itself on line one of the script. For example;
:
# This is the second line of a bourne-shell script.
This may not work on absolutely *every* variant, but it should cover most.
- Der]
Does System V (or some versions of Sys V, or any version of the Un*x,
for that matter) execute a shell script under csh if it begins with a
"#" (for instance if you explicitly say "#!/bin/sh")? I've been told
this, but can't confirm it....
If this is true, what is the best portable way to always have a script
execute under /bin/sh? (don't say "/bin/sh script"....)
Some C-shells that don't recognise this convention will run
bourne-shell scripts correctly if you do the following.
set shell = /bin/sh
NOTE lower case and NOT setenv SHELL /bin/sh
Machines that don't recognise #! seem to be fairly rare now though.
--
Regards, pd at x.co.uk IXI Limited
Paul Davey pd at ixi.uucp 62-74 Burleigh St.
...!uunet!ixi!pd Cambridge U.K.
"These are interesting times" +44 223 462 131 CB1 1OJ
More information about the Comp.unix
mailing list