Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 (Tek) 9/28/84 based on 9/17/84; site tektools.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!ihnp4!drutx!mtuxo!mtunh!mtung!mtunf!ariel!vax135!cornell!uw-beaver!tektronix!daemon!tektools!jerryp From: jerryp@tektools.UUCP (Jerry Peek) Newsgroups: net.unix Subject: Re: Comment lines in the Bourne shell Message-ID: <265@tektools.UUCP> Date: Wed, 12-Jun-85 23:24:55 EDT Article-I.D.: tektools.265 Posted: Wed Jun 12 23:24:55 1985 Date-Received: Sat, 15-Jun-85 06:18:20 EDT References: <1194@uwmacc.UUCP> Reply-To: jerryp@tektools.UUCP (Jerry Peek) Distribution: net Organization: Tektronix, Beaverton OR Lines: 43 Summary: In article <1194@uwmacc.UUCP> jwp@uwmacc.UUCP writes: > ... the comment > > : to use this file type | lpr > > produces a message referring to the pipe, even though the whole > line is commented out. What am I missing? The problem is that the ":" operator isn't a true comment character. It's a "do-nothing" command. The shell still evaluates the rest of the line. So, characters like ' " | > have an effect. Be careful about this. The colon command is useful as a substitute for the "true" command. For instance, you can use it to make an endless "while" loop... while : do command command done It works great in an "if" structure, too: if something then : else command command fi Finally, it's useful with parameter substitution. The example below checks to see if the USER variable is set. If not, the shell complains and exits: : ${USER?} The ":" command is built into the shell. So, it's faster than using "true", which is actually a shell script. --Jerry Peek, UNIX Training Instructor, Tektronix, Inc. US Mail: MS 74-222, P.O. Box 500, Beaverton, OR 97077 uucp: {allegra,decvax,hplabs,ihnp4,ucbvax}!tektronix!tektools!jerryp CS,ARPAnet: jerryp%tektools@tektronix.csnet Phone: 503/627-1603