Path: utzoo!attcan!uunet!ncrlnk!ncr-sd!hp-sdd!hplabs!hplabsb!quan From: quan@hplabsb.UUCP (Suu Quan) Newsgroups: comp.unix.questions Subject: Re: Bourne Shell Comments Problem Summary: #!/bin/sh Keywords: Bourne Shell UNIX Problem Message-ID: <4908@hplabsb.UUCP> Date: 22 Sep 88 15:18:13 GMT References: <292@dsacng1.UUCP> Organization: HP Labs, Manufacturing & Measurement Systems Lab, Palo Alto, CA Lines: 25 In article <292@dsacng1.UUCP>, nab1382@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.