redirection before wildcards

kai at uicsrd.csrd.uiuc.edu kai at uicsrd.csrd.uiuc.edu
Sat Jun 4 04:49:00 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".

Is there any reason for this behavior?  I don't understand why the
wildcard isn't expanded first.  Wouldn't this eliminate one of the
easier ways of filling up disk space?  Does anyone know if this could
cause compatibility problems?  It seems too often that people USE
bugs instead of FIXING them.

Do Bourne and Korn shells act this way as well?


Patrick Wolfe
Internet:  pwolfe at kailand.kai.com
UUCP:      ...!{uunet,ucbvax,ihnp4}!uiucuxc!kailand!pwolfe



More information about the Comp.unix.wizards mailing list