csh weirdness

Brad Turner mbt at bridge2.3Com.Com
Thu Feb 9 09:20:34 AEST 1989


Something strange happened to me today while renameing some files
and I can't explain it so maybe some of you can. Here goes

I had 10 files named zoo-1 zoo-2 zoo-3 .... zoo-08 zoo-09 zoo-10
and I wanted to rename them so that a shell expansion of zoo* would
have them aplhabetized so I did the following:

% foreach i ( 1 2 3 4 5 6 7 8 9 )
> mv zoo-$i zoo-0$i
> end;ls
> end

When the loop was executed it did the first mv then an ls of my current
directory, then the second mv and another ls..... after the last ls
I got the following "end: Not in while/foreach." I was under the impression
that above would execute the loop, then execute an ls. 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" If figured what the
hell and entered the second end. What caused this?

-brad-

-- 
v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v
Brad Turner	1330 Ashleybrook Ln.	(919) 768-2097	| I speak for myself
3Com Corp.	Winston-Salem, NC 27103 mbt at bridge2	| NOT for my employer.



More information about the Comp.unix.questions mailing list