Comment lines in the Bourne shell
Guy Harris
guy at sun.uucp
Tue Jun 11 07:01:10 AEST 1985
> I've noticed that on my system (2.8BSD) the Bourne shell
> comment character doesn't do what I expected. The shell
> still looks at some characters on the line, even though
> the line is commented out. For example, the comment
>
> : to use this file type <name> | lpr
>
> produces a message referring to the pipe, even though the whole
> line is commented out. What am I missing?
The colon isn't really a comment; it's a command that doesn't do anything
(however, it returns "true", so "while :" is equivalent to "while true" -
and faster, since ":" is built-in). The 4.xBSD Bourne shell and the System
<n> Bourne shell also support real comments; a "#" on a command line causes
the rest of the line to be ignored by the shell.
Guy Harris
More information about the Comp.unix
mailing list