Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site psivax.UUCP Path: utzoo!watmath!clyde!cbosgd!ukma!psuvm.bitnet!psuvax1!burdvax!sdcrdcf!psivax!friesen From: friesen@psivax.UUCP (Stanley Friesen) Newsgroups: net.bugs.4bsd Subject: Re: slight problem with grep. Message-ID: <995@psivax.UUCP> Date: Wed, 5-Feb-86 13:25:31 EST Article-I.D.: psivax.995 Posted: Wed Feb 5 13:25:31 1986 Date-Received: Fri, 7-Feb-86 21:03:47 EST References: <9299@ritcv.UUCP> <140@calma.UUCP> Reply-To: friesen@psivax.UUCP (Stanley Friesen) Distribution: net Organization: Pacesetter Systems Inc., Sylmar, CA Lines: 24 Keywords: grep In article <140@calma.UUCP> radzy@calma.UUCP (Tim Radzykewycz) writes: > >Note that this will only happen if 'zzzz' is an existing file. If >either of the following situations occur, there won't be a problem: > grep write * > AAAA <- AAAA doesn't contain 'write' > rm zzzz ; grep write * > zzzz > >In the first situation, the file 'AAAA' is searched first. >In the second situation, the '*' doesn't match the file 'zzzz', >so grep never even opens it. >-- Actually, the second form *does not* work. The shell performs I/O redirection *before* filemname substitution, so the file 'zzzz' does exist and *is* included in the expansion, and grep *will* open it. At least this is true for csh, I tried it(in a harmless way using echo rather than grep). The first one will work because when grep scans AAAA it will be totally empty, due to the shell opening it for writing. -- Sarima (Stanley Friesen) UUCP: {ttidca|ihnp4|sdcrdcf|quad1|nrcvax|bellcore|logico}!psivax!friesen ARPA: ttidca!psivax!friesen@rand-unix.arpa