Shell programming style -- a plea for better shell scripts

John Nelson john at genrad.UUCP
Sat Mar 3 00:54:52 AEST 1984


>  #!/bin/sh

>  will be treated as a comment by the Bourne shell, so its presence
>  cannot possibly hurt.

Excuse me, but while it may be true that the Bourne shell will treat that
line as a comment, any csh running on a system that does not have the
"#!" magic number built into the kernal exec will attempt to run that
script as a csh script.

Csh first attempts to exec a command.  If that fails, it examines the first
character of the file.  If it is a "#", then it runs it as a csh script,
otherwise, it runs it as an sh script.  That line will do precisely the
wrong thing on such a system (like my 68000 unisoft system III).



More information about the Comp.unix mailing list