Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Better ( rm foo; bar > foo ) < foo ?
- X-seq: zsh-users 3543
- From: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxxxxxxxxx>
- To: Hannu Koivisto <azure@xxxxxx>, "Zsh Users' List" <zsh-users@xxxxxxxxxxxxxx>
- Subject: Re: Better ( rm foo; bar > foo ) < foo ?
- Date: Sun, 3 Dec 2000 17:48:21 +0000
- In-reply-to: <87n1edeh8c.fsf@xxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxxxxxx; run by ezmlm
- References: <87n1edeh8c.fsf@xxxxxxxxxxxxxxxxx>
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author