How does #!/bin/sh work ? Why does it sometimes not ?
Ian Watson
ian at hpopd.HP.COM
Fri Oct 12 02:21:23 AEST 1990
I've seen loads of shell scripts start with
#!/bin/sh
as the first line.
I understand that the C shell sees this and knows to execute it as a Bourne
shell script. I've tried this on both HP-UX 7.0 (which works as I expect) and
SCO Unix V.3.2 (which doesn't). I can't seem to get SCO's csh to run the
script through the Bourne shell. Is this feature of the C shell standard
Unix, and am I doing something wrong ?
Why can't I find this feature mentioned in TFM for either HP-UX or SCO Unix ?
Am I just not looking hard enough / in the right place ?
Also, on the HP-UX, I notice that
$ csh script
and
$ csh < script
run the script in the C shell, but
$ csh
followed by
% script
does what I want (runs script through Bourne shell). Can anyone explain under
what circumstances the #!/bin/sh line is or is not honoured by the C shell ?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ian Watson, HP Pinewood Information Systems Division, England.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Phone : (Intl)+44 344 763015
Unix mail (Internet) : ian at hpopd.HP.COM
Unix mail (UUCP) : ...!hplabs!hpopd!ian
Openmail : ian watson/pinewood,lab,hpopd
Openmail from Unix : ian_watson/pinewood_lab_hpopd at hpopd
HPDesk : Ian WATSON/HP1600
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
More information about the Comp.unix.questions
mailing list