home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.xenix.sco
- Path: sparky!uunet!murphy!jpradley!jpr
- From: jpr@jpradley.jpr.com (Jean-Pierre Radley)
- Subject: Re: shell scripts starting with #!/bin/sh
- Organization: Unix in NYC
- Date: Wed, 22 Jul 1992 01:56:18 GMT
- Message-ID: <1992Jul22.015618.1485@jpradley.jpr.com>
- References: <9207140914.AA04480@dynamix.com> <1992Jul20.223702.1924@ve3ied.UUCP>
- Lines: 35
-
- In article <1992Jul20.223702.1924@ve3ied.UUCP> bduncan@ve3ied.UUCP (Bill Duncan) writes:
- >In article <9207140914.AA04480@dynamix.com> david@dynamix.com (David L. Jarvis) writes:
- >>Also ...
- >>
- >>> in SYSTEM V, the first line either has a : or it doesn't.
- >>>
- >>> If it does, it is a bourne shell script (sh) if it doesn't, it is a csh
- >>> script.
- >>
- >>this doesn't sound right to me ... I ran scripts without the : for years
- >>and /bin/sh was always the shell used ... it would seem to me that without
- >>the : indicates to use the current shell as the interpreter, but thats just
- >>my guess ... (perhaps the : just says that if you're using csh that sh
- >>should be used instead?)
- >>
- >
- >You're right on the last count. The Bourne shell will try to execute anything.
- >See Chip's notes. Under Xenix it is a csh hack, and the hack is to execute
- >/bin/sh if it sees the ":" on the first line.
-
-
- WRONG. Xenix or Unix, it matters not. If a C shell runs a script and sees a '#'
- as the very first character in the script, it spawns another C shell.
-
- If it sees any other character, the C shell spawns a Bourne shell.
-
- IOW, the ':' has NO special meaning as the first character of a shell script
- read by csh, but the '#' does have a meaning as the first character of a shell
- script called from csh. ONLY the presense or absence of an initial '#' matters
- to csh.
-
- The csh man page is quite clear on that, but I restated it in all these words
- because some of you are so stubborn.
- --
- Jean-Pierre Radley Unix in NYC jpr@jpr.com jpradley!jpr CIS: 72160,1341
-