Path: 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 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