history question-- Bourne (and C) SHELL COMMENTS

Todd C. Williams yoda at ittatc.ATC.ITT.UUCP
Wed Aug 6 09:44:43 AEST 1986


OK, we're from a mixed (SysV, 4bsd, V6, V7) background here, and a
question has come up which NO ONE is clear on:



	How do you put a comment in a shell script?




This is not in the standard documentation!  S.R.Bourne doesn't mention
it in his 1978 paper, except for the following line from an example script:
	: 'colon is the comment command'

Some say that the colon introduces a comment, but that is not entirely true,
since the line still gets evaluated, at least somewhat.  So what is the
purpose of the colon?  It's not a comment, but it is????

Others say that it is the sharp/pound/number sign, "#" <--that thing, but
if you're on a bsd system, you can't START your Bourne shell script with
it, or the C shell will run your script.  Or should you start with
	#!/bin/sh
???  And does the csh fork here, or exec?

What is the historical development of the : and the # ?  I am SURE that
the colon was the character to use in V7, but....

There are several methods to use here.  Which is the one of choice? and why?
Are there advantages/disadvantages with any of these methods {especially
the #!/bin/sh method above}?

-- 
+------------------------------------------------------------------------------+
|  Todd C. Williams			|  "Summer blonds		       |
|  ITT Defense Communications		|   revealing tan lines,	       |
|  Nutley, NJ				|   I'll make more moves than	       |
|  {decvax, et al.}!ittatc!dcdvaxb!tcw	|   ALLIED VAN LINES!"		       |
|  +1 201 284 3305			|     --from: "I wanna be a lifeguard" |
|  I love to receive e-mail!		|			by BLOTTO      |
+------------------------------------------------------------------------------+



More information about the Comp.unix mailing list