From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25931 invoked from network); 3 Jun 2001 23:07:37 -0000 Received: from sunsite.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 3 Jun 2001 23:07:37 -0000 Received: (qmail 28025 invoked by alias); 3 Jun 2001 23:07:26 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 14702 Received: (qmail 28014 invoked from network); 3 Jun 2001 23:07:25 -0000 From: "Bart Schaefer" Message-Id: <1010603230636.ZM30691@candle.brasslantern.com> Date: Sun, 3 Jun 2001 23:06:35 +0000 In-Reply-To: <20010603231405.92A4614285@pwstephenson.fsnet.co.uk> Comments: In reply to Peter Stephenson "Re: <> redirection operator" (Jun 4, 12:14am) References: <20010603231405.92A4614285@pwstephenson.fsnet.co.uk> X-Mailer: Z-Mail (5.0.0 30July97) To: zsh-workers@sunsite.dk Subject: Re: <> redirection operator MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Jun 4, 12:14am, Peter Stephenson wrote: } } % echo test >/tmp/redirtest } % sed 's/e/Z/g' <>/tmp/redirtest 1>&0 } % cat /tmp/redirtest } tZst } } (This happens to work in place even on a mult-line file, but I think you } have to be pretty sure what you're doing to use it like that. Finally I've } got an example of this for the user guide, anyway.) I gave an example of using <> a few months ago ... let's see ... ah, here it is, sent to zsh-users in December: ------------ Yes, <> means "open for both reading and writing," which is sometimes useful as it's the mode in which stdin/out/err are typically opened on a terminal. The implicit descriptor to the left of <> is 0, so unless you supply another number it opens stdin. If you give a descriptor number, you can use <> to open a file for overwrite-without-truncation: zsh% print "foo\nbar" >| foo zsh% foo zsh% foo But this is pretty dangerous because if sed ever writes more bytes than it has already read, it'll start re-reading what it wrote. -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net