*BSD News Article 83329


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!news.wildstar.net!serv.hinet.net!spring.edu.tw!howland.erols.net!EU.net!usenet2.news.uk.psi.net!uknet!usenet1.news.uk.psi.net!uknet!dispatch.news.demon.net!demon!awfulhak.demon.co.uk!awfulhak.demon.co.uk!awfulhak.demon.co.uk!not-for-mail
From: brian@anorak.coverform.lan (Brian Somers)
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Re: cat foo* > foo.bar    causes infinite loop
Date: 20 Nov 1996 20:47:37 -0000
Organization: Coverform Ltd.
Lines: 58
Sender: brian@awfulhak.demon.co.uk
Message-ID: <56vqp9$1a5@anorak.coverform.lan>
References: <328A1236.32C4@pilot.msu.edu> <56itkk$h59$1@nic.wat.hookup.net>
    <56mktc$b4a@uriah.heep.sax.de>
Reply-To: brian%anorak.coverform.lan@awfulhak.demon.co.uk
NNTP-Posting-Host: localhost.coverform.lan
X-NNTP-Posting-Host: awfulhak.demon.co.uk
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Newsreader: knews 0.9.8

In article <56mktc$b4a@uriah.heep.sax.de>,
	j@uriah.heep.sax.de (J Wunsch) writes:
: schaffer@wat.hookup.net wrote:
: 
>> 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*).
: 
: Just for the records, all of the available shells for FreeBSD (csh,
: tcsh, sh, bash, zsh) experience this behaviour, except the pdksh.
: 
: (I haven't tried to get a genuine ksh, but somebody else already
: responded that it doesn't show this artifact.)

Hmmmm,

anorak:~/tmp $ echo x >foo1
anorak:~/tmp $ echo x >foo2
anorak:~/tmp $ echo x >foo3
anorak:~/tmp $ cat * >foo.bar
anorak:~/tmp $ l
total 8
-rw-rw-rw-  1 brian  research  6 Nov 20 19:25 foo.bar
-rw-rw-rw-  1 brian  research  2 Nov 20 19:25 foo1
-rw-rw-rw-  1 brian  research  2 Nov 20 19:25 foo2
-rw-rw-rw-  1 brian  research  2 Nov 20 19:25 foo3
anorak:~/tmp $ echo $BASH_VERSION 
1.14.7(1)
anorak:~/tmp $ head -1 /etc/motd
FreeBSD 2.2-961014-SNAP (ANORAK) #0: Thu Oct 24 03:26:56 BST 1996


and

awfulhak:brian:~/tmp $ echo x >foo1
awfulhak:brian:~/tmp $ echo x >foo2
awfulhak:brian:~/tmp $ echo x >foo3
awfulhak:brian:~/tmp $ cat foo* >foo.bar
awfulhak:brian:~/tmp $ l
total 2
-rw-rw-r--  1 brian  research  6 Nov 20 20:32 foo.bar
-rw-rw-r--  1 brian  research  2 Nov 20 20:32 foo1
-rw-rw-r--  1 brian  research  2 Nov 20 20:32 foo2
-rw-rw-r--  1 brian  research  2 Nov 20 20:32 foo3
awfulhak:brian:~/tmp $ echo $BASH_VERSION
1.14.6(1)
awfulhak:brian:~/tmp $ head -1 /etc/motd
FreeBSD 2.1.5-RELEASE (AWFULHAK) #0: Sat Nov 16 18:03:35 GMT 1996

In fact, I get the same results using the csh and sh (ash) as supplied in
both the above versions of FreeBSD !  Am I missing something ?

-- 
Brian <brian%anorak.coverform.lan@awfulhak.demon.co.uk>
      <http://www.awfulhak.demon.co.uk/>
Don't _EVER_ lose your sense of humour....
.