Bourne Shell Comments Problem
Suu Quan
quan at hplabsb.UUCP
Fri Sep 23 01:18:13 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.
>
I bet your shell script will work with "sh shellname".
Doing either "sh -x shellname" or "sh shellname" forces the file
to be interpreted by the Bourne shell.
Usually, a # as the very first character of a file is NOT a
comment, but an indication of what shell should be used to interpret this.
I have the habit to use as 1st line :
"#! /bin/sh"
or
"#! /bin/csh"
Everything else (as 1st character) implies using your favorite shell.
NOTE : " #! /bin/csh" as the first line will be executed by your favorite
shell, not csh : 1st character is blank.
More information about the Comp.unix.questions
mailing list