konath@sj.ate.slb.com (Kannan Konath) (01/24/91)
I have a few shell scripts that are either csh (C shell) or sh (Bourne shell) scripts. However the facility of specifying the type of script, that is available in the Berkeley/SunOS environement (ie. #!/bin/csh or #!/bin/sh), does not seem to work in SCO ODT (SCO Unix). I have two questions: a) Is this the way System V R3 executes scripts or is it a bug in SCO Unix? Is "#!/bin/<shell_name>" in a shell script understood by SysVR3. b) Is there any way for me to run these scripts automatically without having to resort to "csh <csh_script>" or "sh <sh_script>" and given that my default shell could be either one of the shells, ie., csh or sh. One clumsy method that I did think of using was to have two files. Assume the shell script is to be called SHELLscr, then have two files SHELLscr and one of SHELLscr.csh or SHELLscr.sh. The file SHELLscr just contains one line "csh SHELLscr.csh" or "sh SHELLscr.sh" depending on the type of shell script. I haven't tried this but it should work. kannan konath@sj.ate.slb.com
rvdp@cs.vu.nl (Ronald van der Pol) (01/25/91)
konath@sj.ate.slb.com (Kannan Konath) writes: >I have a few shell scripts that are either csh (C shell) or sh (Bourne >shell) scripts. However the facility of specifying the type of script, >that is available in the Berkeley/SunOS environement (ie. #!/bin/csh or >#!/bin/sh), does not seem to work in SCO ODT (SCO Unix). The whole world is using '#!', so SCO decided to use ':' instead. -- Ronald van der Pol <rvdp@cs.vu.nl>
sef@kithrup.COM (Sean Eric Fagan) (01/26/91)
In article <8836@star.cs.vu.nl> rvdp@cs.vu.nl (Ronald van der Pol) writes: > The whole world is using '#!', so SCO decided to use ':' instead. Uhm... sorry. ':' as the first character of a bourne-shell script is the *only* portable way to get to run under bourne shell. And the whole world is *not* using '#!'. -- Sean Eric Fagan | "I made the universe, but please don't blame me for it; sef@kithrup.COM | I had a bellyache at the time." -----------------+ -- The Turtle (Stephen King, _It_) Any opinions expressed are my own, and generally unpopular with others.
allbery@NCoast.ORG (Brandon S. Allbery KB8JRR) (01/26/91)
As quoted from <8836@star.cs.vu.nl> by rvdp@cs.vu.nl (Ronald van der Pol): +--------------- | konath@sj.ate.slb.com (Kannan Konath) writes: | >I have a few shell scripts that are either csh (C shell) or sh (Bourne | >shell) scripts. However the facility of specifying the type of script, | >that is available in the Berkeley/SunOS environement (ie. #!/bin/csh or | >#!/bin/sh), does not seem to work in SCO ODT (SCO Unix). | The whole world is using '#!', so SCO decided to use ':' instead. +--------------- Nope --- SCO actually goes blameless for a change. #! is a Berzerkeleyism, not to be found in standard SVR3, or even in SCO's corruption of same. ++Brandon -- Me: Brandon S. Allbery VHF/UHF: KB8JRR on 220, 2m, 440 Internet: allbery@NCoast.ORG Packet: KB8JRR @ WA8BXN America OnLine: KB8JRR AMPR: KB8JRR.AmPR.ORG [44.70.4.88] uunet!usenet.ins.cwru.edu!ncoast!allbery Delphi: ALLBERY
jackv@turnkey.tcc.com (Jack F. Vogel) (01/27/91)
In article <1991Jan26.033315.10820@NCoast.ORG> allbery@ncoast.ORG (Brandon S. Allbery KB8JRR) writes: >As quoted from <8836@star.cs.vu.nl> by rvdp@cs.vu.nl (Ronald van der Pol): >| The whole world is using '#!', so SCO decided to use ':' instead. >Nope --- SCO actually goes blameless for a change. #! is a Berzerkeleyism, >not to be found in standard SVR3, or even in SCO's corruption of same. Well, it may be a BSDism but it is a nice feature to have, and as for not being found in "standard SVR3", Interactive implemented it in either 2.0.2 or 2.2 (not sure which it was), which probably means Esix and Dell would have it as well. So, what we have here isn't a case of SCO corruption, just a failure to provide a useful and desireable feature :-}. Disclaimer: I don't speak for my employer. -- Jack F. Vogel jackv@locus.com AIX370 Technical Support - or - Locus Computing Corp. jackv@turnkey.TCC.COM
peter@ficc.ferranti.com (Peter da Silva) (01/29/91)
In article <8836@star.cs.vu.nl> rvdp@cs.vu.nl (Ronald van der Pol) writes: > The whole world is using '#!', so SCO decided to use ':' instead. It's not really SCO's fault (what!?). This is standard System V behaviour. The #! bit was a Berkeleyism that AT&T never picked up. -- Peter da Silva. `-_-' peter@ferranti.com +1 713 274 5180. 'U` "Have you hugged your wolf today?"
james@bigtex.cactus.org (James Van Artsdalen) (01/29/91)
In <7329FO1@xds13.ferranti.com>, peter@ficc.ferranti.com (Peter da Silva) wrote: ] In article <8836@star.cs.vu.nl> rvdp@cs.vu.nl (Ronald van der Pol) writes: | The whole world is using '#!', so SCO decided to use ':' instead. ] It's not really SCO's fault (what!?). This is standard System V behaviour. ] The #! bit was a Berkeleyism that AT&T never picked up. AT&T has picked it up and it's standard SysV behavior - SysVr4. :-) -- James R. Van Artsdalen james@bigtex.cactus.org "Live Free or Die" Dell Computer Co 9505 Arboretum Blvd Austin TX 78759 512-338-8789
aland@informix.com (Colonel Panic) (01/30/91)
In article <1991Jan25.195557.25955@kithrup.COM> sef@kithrup.COM (Sean Eric Fagan) writes: >In article <8836@star.cs.vu.nl> rvdp@cs.vu.nl (Ronald van der Pol) writes: >> The whole world is using '#!', so SCO decided to use ':' instead. >Uhm... sorry. ':' as the first character of a bourne-shell script is the >*only* portable way to get to run under bourne shell. And the whole world >is *not* using '#!'. It was my understanding also that '#!' worked only for BSD. In BSD, you can say '#!anything', not necessarily just shells (e.g. awk scripts run great by saying '#!/bin/awk -f'). Now, the bonus question: is there an analogous directive for setting up a C shell script that will work in non-BSD systems ('#!/bin/csh' doesn't cut it in SVR3)? -- Alan Denney # aland@informix.com # {pyramid|uunet}!infmx!aland "Cut the crap, Camel Boy, or the 101st Airborne drops down your chimney and feeds you your own socks." - From Letterman's "Top 10 Things Overheard at the Baker/Aziz Meeting"
peter@ficc.ferranti.com (Peter da Silva) (01/30/91)
In article <53661@bigtex.cactus.org> james@bigtex.cactus.org (James Van Artsdalen) writes: > AT&T has picked it up and it's standard SysV behavior - SysVr4. :-) From now until the next release, consider it standard... -- Peter da Silva. `-_-' peter@ferranti.com +1 713 274 5180. 'U` "Have you hugged your wolf today?"
konath@sj.ate.slb.com (Kannan Konath) (02/01/91)
In article <1991Jan29.230217.14825@informix.com> aland@informix.com (Colonel Panic) writes: >Now, the bonus question: is there an analogous directive for setting >up a C shell script that will work in non-BSD systems ('#!/bin/csh' >doesn't cut it in SVR3)? Actually, I had asked this question originally and it got lost in all the responses. If you use csh you can execute either sh or csh scripts. If the first character of a shell script starts with a # then then the script will be treated as a csh script. If the first character is anything but a # (I find it's usually a colon ":") then the script will be treated as a bourne shell script. You should however use the csh when doing such things. There is a short paragraph in the man pages of both sh and csh (SCO ODT 1.0) that mention this behaviour. It's an extremely clumsy way of System V R3 doing things. But this is not as irritating as trying to extract tar files in which file or directory names happen to be longer than 14 characters. I spend half my time counting the number of characters in filenames. I wish they had kept the length of filenames down to 8 characters since it's much easier to detect this at a glance. Fourteen character gives you a headache and the ability to count to 14. kannan konath@sj.ate.slb.com