csh weirdness

Maarten Litmaath maart at cs.vu.nl
Fri Feb 10 05:41:42 AEST 1989


mbt at bridge2.3Com.Com (Brad Turner) writes:
\% foreach i ( 1 2 3 4 5 6 7 8 9 )
\> mv zoo-$i zoo-0$i
\> end;ls
\> end

\... I had no intention
\of putting in the last end statement, but when the shell gave me the
\secondary prompt after I had already entered "end;ls" I figured what the
\hell and entered the second end. What caused this?

Welcome to csh! It's just the way csh works: confusing syntax, buggy parser.
Beware if you want to use anything more difficult than:

	alias	ll	ls -la
	set	history = 20

The `end' statement must either appear alone on a line, or followed by a
semicolon PRECEDED BY WHITESPACE! Everything after the `;' (on the same line)
is PART OF THE LOOP!
Now go home, switch on your turntable and put on some record called `Crying'.
-- 
 "I love it                            |Maarten Litmaath @ VU Amsterdam:
          when a plan comes together." |maart at cs.vu.nl, mcvax!botter!maart



More information about the Comp.unix.questions mailing list