home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / unix / xenix / sco / 2555 < prev    next >
Encoding:
Text File  |  1992-07-22  |  1.9 KB  |  46 lines

  1. Newsgroups: comp.unix.xenix.sco
  2. Path: sparky!uunet!murphy!jpradley!jpr
  3. From: jpr@jpradley.jpr.com (Jean-Pierre Radley)
  4. Subject: Re: shell scripts starting with #!/bin/sh
  5. Organization: Unix in NYC
  6. Date: Wed, 22 Jul 1992 01:56:18 GMT
  7. Message-ID: <1992Jul22.015618.1485@jpradley.jpr.com>
  8. References: <9207140914.AA04480@dynamix.com> <1992Jul20.223702.1924@ve3ied.UUCP>
  9. Lines: 35
  10.  
  11. In article <1992Jul20.223702.1924@ve3ied.UUCP> bduncan@ve3ied.UUCP (Bill Duncan) writes:
  12. >In article <9207140914.AA04480@dynamix.com> david@dynamix.com (David L. Jarvis) writes:
  13. >>Also ...
  14. >>
  15. >>> in SYSTEM V, the first line either has a : or it doesn't.
  16. >>> 
  17. >>> If it does, it is a bourne shell script (sh) if it doesn't, it is a csh
  18. >>> script.
  19. >>
  20. >>this doesn't sound right to me ... I ran scripts without the : for years
  21. >>and /bin/sh was always the shell used ... it would seem to me that without
  22. >>the : indicates to use the current shell as the interpreter, but thats just
  23. >>my guess ... (perhaps the : just says that if you're using csh that sh
  24. >>should be used instead?)
  25. >>
  26. >
  27. >You're right on the last count.  The Bourne shell will try to execute anything.
  28. >See Chip's notes.  Under Xenix it is a csh hack, and the hack is to execute
  29. >/bin/sh if it sees the ":" on the first line.
  30.  
  31.  
  32. WRONG. Xenix or Unix, it matters not. If a C shell runs a script and sees a '#'
  33. as the very first character in the script, it spawns another C shell.
  34.  
  35. If it sees any other character, the C shell spawns a Bourne shell.
  36.  
  37. IOW, the ':' has NO special meaning as the first character of a shell script
  38. read by csh, but the '#' does have a meaning as the first character of a shell
  39. script called from csh. ONLY the presense or absence of an initial '#' matters
  40. to csh.
  41.  
  42. The csh man page is quite clear on that, but I restated it in all these words
  43. because some of you are so stubborn.
  44. -- 
  45. Jean-Pierre Radley   Unix in NYC   jpr@jpr.com   jpradley!jpr   CIS: 72160,1341
  46.