redirection before wildcards

Shankar Unni shankar at hpclscu.HP.COM
Fri Jun 10 11:01:16 AEST 1988


>    It's pretty well known that commands like "grep whatever * > out" can
>    cause infinate loops, because C-shell will create the file "out"
>    before expanding the asterisk wildcard, and grep never reaches EOF
>    once it reaches the file "out".
> 
> Try `grep whatever * > .out'. Small consolation if you didn't :-)

But, for curiosity's sake, why exactly are redirections performed *before*
wildcard expansions?  For "historical" ( :-> ) reasons only? Or is there a
grander design behind it?

--
Shankar.



More information about the Comp.unix.wizards mailing list