Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!ncar!ames!vsi1!altos!megadon!clp From: pd@x.co.uk (Paul Davey) Newsgroups: comp.unix Subject: Re: Shell scripts starting with "#" Message-ID: <2136@megadon.UUCP> Date: 10 Oct 90 02:56:35 GMT References: <3695@zorba.Tynan.COM> Organization: IXI Ltd. Lines: 30 Approved: clp@megadon.UUCP In-Reply-To: df@sei.cmu.edu's message of 13 Jul 90 21:13:42 GMT Apparently-To: comp-unix@uunet.uucp [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@x.co.uk IXI Limited Paul Davey pd@ixi.uucp 62-74 Burleigh St. ...!uunet!ixi!pd Cambridge U.K. "These are interesting times" +44 223 462 131 CB1 1OJ