Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
zsh needs try-finally
- X-seq: zsh-workers 20000
- From: Dave Yost <Dave@xxxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: zsh needs try-finally
- Date: Tue, 1 Jun 2004 11:01:09 -0700
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
Hi.
Zsh needs a mechanism a la Java's try-finally or lisp's unwind-protect.
Example:
for file in $*
do
tmp=$file.TMP-$commandName
mv -f $file $tmp
(eval $filter) < $tmp > $file
rm -f $tmp
done
The 'rm -f $tmp' command should be in a finally block, something like this:
for file in $*
do
tmp=$file.TMP-$commandName
mv -f $file $tmp
try
(eval $filter) < $tmp > $file
finally
rm -f $tmp
yrt
done
See also: http://yost.com/computers/java/finally-throwable.html
Thanks
Dave
Messages sorted by:
Reverse Date,
Date,
Thread,
Author