🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.bugs.4bsd
Article #356

Re: Bug in csh

#356
From: Root Boy Jim
Date: Thu, 25 Apr 1991 18:54
36 lines
1430 bytes
In article <24610@as0c.sei.cmu.edu> dvk@sei.cmu.edu (Daniel Klein) writes:
>
>Well, here's an interesting one! Try typing:
>
>% echo hello & while (1)
>? end
>
>The "echo hello" gets executed at each loop of the while.  A similar bug
>does not exist with foreach, though.

You should know better than to try this. Csh is intrinsicly broken.
Anyway, it's not a bug, it's a feature. It's documented:

	The foreach, switch, and while statements, as well as the
	if-then-else form of the if statement require that the major
	keywords appear in a single simple command on an input line
	as shown below.

Sun says it better:

	Each occurrence of a foreach, switch, while,  if...then  and
	else built-in must appear as the first word on its own input line.

BTW, don't try piping to them or I/O redirection either.

Another broken feature: for integer values of X & Y try:

	(repeat X repeat Y echo foo) | wc -l

What is printed is not X*Y, but rather X+Y-1.

No one cares enuf to fix csh.

-- 
		[rbj@uunet 1] stty sane
		unknown mode: sane
Technical Details
Message-ID: <130397@uunet.UU.NET>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!olivea!uunet!rbj
References: <24610@as0c.sei.cmu.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!olivea!uunet!rbj
From: rbj@uunet.UU.NET (Root Boy Jim)
Newsgroups: comp.bugs.4bsd
Subject: Re: Bug in csh
Message-ID: <130397@uunet.UU.NET>
Date: 25 Apr 91 18:54:33 GMT
References: <24610@as0c.sei.cmu.edu>
Organization: UUNET Communications Services, Falls Church, VA
Lines: 36