Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

zsh needs try-finally



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