Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site gatech.CSNET Path: utzoo!watmath!clyde!burl!ulysses!gatech!arnold From: arnold@gatech.CSNET (Arnold Robbins) Newsgroups: net.unix Subject: Re: # comment character (special casing inputs) Message-ID: <378@gatech.CSNET> Date: Fri, 28-Jun-85 12:59:05 EDT Article-I.D.: gatech.378 Posted: Fri Jun 28 12:59:05 1985 Date-Received: Sun, 30-Jun-85 00:46:19 EDT References: <291@ucdavis.UUCP> <764@kuling.UUCP> Distribution: net Organization: Pr1mebusters! Lines: 43 In article <764@kuling> andersa@kuling.UUCP (Anders Andersson) writes: > In article <291@ucdavis.UUCP> ccrrick@ucdavis.UUCP (Rick Heli) writes: > >Can anyone tell me why the # character is a comment in INTERACTIVE > >mode in the shell? I mean, who goes around making comments that > >will never be seen again while running the shell in interactive > >mode? > > Well, what function should # have in interactive mode then? > No function is also a kind of function. The idea is that things should > work the same regardless of mode -- imagine the problems if commands, > syntax etc. didn't behave the same when run from a file rather than > being typed in interactively. The consequent behaviour makes both > learning and debugging easy. Giving # a special "interactive" function > would merely increase documentation size and human brain load, instead > of functionality... There is a major exception to this --- command history. The csh follows the above philosophy, and will actually try to do history evaluations inside shell files. This can bite you badly. Suppose you have a file with e-mail addresses: site1!persona site2!personb The csh command in a shell file Mail `cat destinations` will cause the csh to try and do a history evaluation (and promptly bomb). (Yes, If you say site1\!persona, it'll work, but that isn't the point.) The above example actually happened to me. In the history mechanism for /bin/sh I posted a couple of weeks ago, I explicitly turn history off inside a shell file, which is how (I think) it should be. [Note, I am not disagreeing with the overall philosophy of not treating different inputs specially, just pointing out that there are exceptions.] -- Arnold Robbins CSNET: arnold@gatech ARPA: arnold%gatech.csnet@csnet-relay.arpa UUCP: { akgua, allegra, hplabs, ihnp4, seismo, ut-sally }!gatech!arnold Hello. You have reached the Coalition to Eliminate Answering Machines. Unfortunately, no one can come to the phone right now....