🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

2 total messages Started by Daniel Klein Thu, 25 Apr 1991 18:30
Bug in csh
#355
Author: Daniel Klein
Date: Thu, 25 Apr 1991 18:30
13 lines
825 bytes
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.

-- ============ -- =========== -- =========== -- =========== -- =========== --
"The only thing that separates us from the animals is superstition and
mindless rituals" (Latke)      Daniel Klein	CMU-SEI   +1 412/268-7791
						dvk@sei.cmu.edu
Re: Bug in csh
#356
Author: 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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads