From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20436 invoked from network); 3 Dec 2000 17:48:59 -0000 Received: from sunsite.dk (HELO sunsite.auc.dk) (130.225.51.30) by ns1.primenet.com.au with SMTP; 3 Dec 2000 17:48:59 -0000 Received: (qmail 3987 invoked by alias); 3 Dec 2000 17:48:40 -0000 Mailing-List: contact zsh-users-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 3543 Received: (qmail 3980 invoked from network); 3 Dec 2000 17:48:38 -0000 From: "Bart Schaefer" Message-Id: <1001203174821.ZM12458@candle.brasslantern.com> Date: Sun, 3 Dec 2000 17:48:21 +0000 In-Reply-To: <87n1edeh8c.fsf@senstation.vvf.fi> Comments: In reply to Hannu Koivisto "Better ( rm foo; bar > foo ) < foo ?" (Dec 3, 4:01pm) References: <87n1edeh8c.fsf@senstation.vvf.fi> X-Mailer: Z-Mail (5.0.0 30July97) To: Hannu Koivisto , "Zsh Users' List" Subject: Re: Better ( rm foo; bar > foo ) < foo ? MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii How about mv -i =(bar < foo) foo ?? As long as `bar' produces some kind of failure output, that should be OK for interactive use. A little more input on what you think would NOT be clumsy would help. For example, would rewrite sed 's/foo/bar/g' foo be OK? Just take your original "in a script, I'd probably write" and put it in a function: rewrite() { local TMPFILE=${TMPPREFIX}rewrite.$$ # Whatever $argv[1,-2] < $argv[-1] > $TMPFILE || rm -f $TMPFILE [[ -f $TMPFILE ]] && mv -f $TMPFILE $argv[-1] } You can probably figure out what to do if you'd prefer the syntax rewrite foo sed 's/foo/bar/g' instead ... -- 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