Bourne Shell Comments Problem

Paul De Bra debra at alice.UUCP
Thu Sep 22 03:33:50 AEST 1988


In article <292 at dsacng1.UUCP> nab1382 at dsacng1.UUCP (Dick Hauser) writes:
>I have a question regarding usage of a comment line in the Bourne
>Shell.  Here is the situation.  The comment indicator (i.e #) is
>in position 1 of the first record of the file.  The comment line
>was followed by a read command for a varibale.  When the shell  
>was executed using "sh -x shellname", everything worked.  But
>when the shell is executed, and execution is not traced, an error
>message "read not found" is displayed.

On some Unix systems instead of looking for the magic number #!
the kernel only looks for # to find out whether a file is a shell
script, possibly for another shell.
So the # sign on position 1 of the first line of a file is not REALLY
a comment indicator on these odd unix systems.

Easy fix: start with an empty line first and start the comment on line 2.

Paul.



More information about the Comp.unix.questions mailing list