*BSD News Article 83013


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!munnari.OZ.AU!news.ecn.uoknor.edu!feed1.news.erols.com!news.idt.net!news.bbnplanet.com!cam-news-hub1.bbnplanet.com!news.mathworks.com!newsfeed.internetmci.com!hobbes.sco.COM!xenitec!nic.wat.hookup.net!not-for-mail
From: schaffer@wat.hookup.net
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Re: cat foo* > foo.bar    causes infinite loop
Date: 15 Nov 1996 23:16:36 GMT
Organization: HookUp Communication Corporation, Waterloo, Ontario, CANADA
Lines: 17
Message-ID: <56itkk$h59$1@nic.wat.hookup.net>
References: <328A1236.32C4@pilot.msu.edu>
Reply-To: schaffer@wat.hookup.net
NNTP-Posting-Host: schaffer.wat.hookup.net
X-Newsreader: IBM NewsReader/2 v1.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".

You should expect this behavior with any shell (no, I haven't tried):
basically, the shell first looks for pipes, redirections etc.  For
redirected stdout it creates the target file, then evaluates the command
(cat foo*).

Hartmann Schaffer