Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!dali.cs.montana.edu!uakari.primate.wisc.edu!zaphod.mps.ohio-state.edu!sdd.hp.com!hplabs!hpda!hpcuhb!hpsqf!hpopd!ian From: ian@hpopd.HP.COM (Ian Watson) Newsgroups: comp.unix.questions Subject: How does #!/bin/sh work ? Why does it sometimes not ? Message-ID: <7980005@hpopd.HP.COM> Date: 11 Oct 90 16:21:23 GMT Organization: HP PWD, Pinewood UK. Lines: 35 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@hpopd.HP.COM Unix mail (UUCP) : ...!hplabs!hpopd!ian Openmail : ian watson/pinewood,lab,hpopd Openmail from Unix : ian_watson/pinewood_lab_hpopd@hpopd HPDesk : Ian WATSON/HP1600 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~