Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!ucbvax!bloom-beacon!athena.mit.edu!jik From: jik@athena.mit.edu (Jonathan I. Kamens) Newsgroups: comp.unix.questions Subject: Re: # not honored? Message-ID: <1990Mar28.231208.9461@athena.mit.edu> Date: 28 Mar 90 23:12:08 GMT References: Sender: news@athena.mit.edu (News system) Reply-To: jik@athena.mit.edu (Jonathan I. Kamens) Organization: Massachusetts Institute of Technology Lines: 30 In article , mcdaniel@amara.uucp (Tim McDaniel) writes: > But I had thought that "#" as the first byte of a file meant "this is > a C shell script" (unless, of course, the first two bytes are "#!"). > It appears that the Bourne shell does not respect this rule. > Should it? (On systems where the C shell exists and uses this > convention.) This is *almost* right. "#" as the first byte of a file means "this is a C shell script" *only if the script is being executed by the C shell*. While "#!" is a kernel thing, the "#" by itself thing is figured out by the C shell, not by the kernel. From the man page csh(1): Since many systems use either the standard version 6 or version 7 shells whose shell scripts are not compatible with this shell, the shell will execute such a `standard' shell if the first character of a script is not a `#', i.e. if the script does not start with a comment. Therefore, if your script has to always be executed by the C shell, even when it is executed by someone using another shell, you *must* have the "#!/bin/csh -f" at the top. Jonathan Kamens USnail: MIT Project Athena 11 Ashford Terrace jik@Athena.MIT.EDU Allston, MA 02134 Office: 617-253-8495 Home: 617-782-0710