Return to BSD News archive
Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!news.mel.connect.com.au!munnari.OZ.AU!news.ecn.uoknor.edu!feed1.news.erols.com!howland.erols.net!EU.net!main.Germany.EU.net!Bielefeld.Germany.EU.net!news.sni.de!news From: mollers.pad@sni.de (Josef Moellers) Newsgroups: comp.unix.bsd.freebsd.misc Subject: Re: cat foo* > foo.bar causes infinite loop Date: 14 Nov 1996 07:19:32 GMT Organization: Siemens Nixdorf Informationssysteme AG, Paderborn, Germany Lines: 51 Message-ID: <56eh64$fj5@linus.pdb.sni.de> References: <328A1236.32C4@pilot.msu.edu> NNTP-Posting-Host: 129.103.170.10 X-Newsreader: NN version 6.5.0 #2 In <328A1236.32C4@pilot.msu.edu> Ed Symanzik <zik@pilot.msu.edu> writes: >If I create three files foo1, foo2, and foo3 then run the command > cat foo* > foo.bar >in csh I get an infinite loop (at least until the partition fills up). >Seems to me that '*' should be evaluated before new files are created. >I have seen systems that don't behave this way give errors similar to >"can't open foo.bar for both input and output". Seems to be a csh problem. I just tried cat ppp* > ppp123 in the csh on our SVR4-based systems and got cat: Input/output files 'ppp123' identical In the korn shell, no error message was given and ppp123 was created with the contents of ppp1, ppp2, and ppp3. It looks as if csh first does the redirection, then the expansion of the filename pattern. However, "man csh" says After displaying the prompt, the shell reads the commands entered at the terminal and then processes each input line as follows: ... 7. It substitutes file names for patterns (see File name substitution). 8. It redirects I/O as required (see I/O redirection). ... Since the filenames used in I/O redirection are also subject to file name substitution, this makes sense. I also tried this on Linux 1.2.13 (bash vs. csh). Same behaviour (different error message, though B-{) Seems like an inherent bug in csh. Happy expanding, Josef -- Josef Moellers mollers.pad@sni.de PS Dieser Artikel enthaelt einzig und allein meine persoenlichen Ansichten! PS This article contains my own, personal opinion only!