[net.unix] 2.8BSD Bourne shell: no comments?

jwp@uwmacc.UUCP (jeffrey w percival) (06/19/85)

My system doesn't seem to support the '#' comment character.
Is there an easy fix?

-- 
	Jeff Percival ...!uwvax!uwmacc!jwp

keith@motel6.UUCP (Keith Packard) (06/24/85)

In article <1228@uwmacc.UUCP> jwp@uwmacc.UUCP (jeffrey w percival) writes:
>My system doesn't seem to support the '#' comment character.
>Is there an easy fix?
>
>-- 
>	Jeff Percival ...!uwvax!uwmacc!jwp

The listing below is extracted from main.c.  It represents a major hack
that lets # comments work most of the time.  They only work if
the # is the *first* character on the line, not any other time!
It was quick and dirty.  It will stay this way until I get the
Bourne shell mods for job control.

		IF (flags&prompt) ANDF standin->fstak==0 ANDF !eof
		THEN	IF mailnod.namval
			    ANDF stat(mailnod.namval,&statb)>=0 ANDF statb.st_size
			    ANDF (statb.st_mtime != mailtime)
			    ANDF mailtime
			THEN	prs(mailmsg)
			FI
			mailtime=statb.st_mtime;
			prs(ps1nod.namval); alarm(TIMEOUT); flags |= waiting;
		FI

		trapnote=0; peekc=readc();
!		/*
!		 *	major kludge to allow '#' to delimit
!		 *	comment lines
!		 */
!		if (peekc == '#') {
!			while (readc() != '\n');
!			continue;
!		}
		IF eof
		THEN	return;
		FI
		alarm(0); flags &= ~waiting;
		execute(cmd(NL,MTFLG),0);
		eof |= (flags&oneflg);
	POOL
}

Keith Packard
...!tektronix!reed!motel6!keith

atchison@umn-cs.UUCP (Lee Atchison) (06/24/85)

Some versions of the Bourne shell don't allow the '#' character as a comment.
The version included with 2.8 and 2.9 don't.  There have been fixes posted
to net.bugs.2bsd about this, but I don't know what the fix is off hand.
However, you can use the ':' character as a comment in these versions of the
Bourne shell.

		-lee

-- 
Lee Atchison
CSci Dept.
126 Lind Hall
Univ. of Minn.
Minneapolis, MN 55455
...!ihnp4!umn-cs!atchison

rs@mirror.UUCP (06/25/85)

> My /bin/sh doesn't support "#" as a comment character.

The easiest thing to do seems to be this:
	: 'this is a $funny comment <yow!>'

the single-quotes are "strong" enough to suppress side-effects
caused by evaulation of meta-charcters.