csh misconceptions

buck%nrl-css at sri-unix.UUCP buck%nrl-css at sri-unix.UUCP
Sun Feb 26 13:13:28 AEST 1984


From:  Joe Buck <buck at nrl-css>


There's been a good deal of misinformation on this list about csh and
the "#!" construction.

First off, 4.xbsd uses sh, not csh, to execute all shell scripts UNLESS
the first line is "#! /bin/csh". Therefore a first line of "#! /bin/sh"
is not necessary. Second, originally a line starting with a colon was
a comment, so sh on some systems does not consider "#" a comment character.
Therefore the suggestion that all users include #!/bin/sh in their shell
scripts is not only unnecessary for portability, but counterproductive.

By the way, on Berkeley systems, any program, not just sh and csh, may
be specified in the first line with "#!". There are some restrictions
though; the full pathname must be given and the command must be less
than 32 characters. There are other restrictions also. This feature is
in the kernel, not the shells. The whole file, including the first line,
is the input for the command, so the command must treat "#" as a comment
character.

-Joe



More information about the Comp.unix mailing list