zsh-workers
 help / color / mirror / code / Atom feed
* zsh needs try-finally
@ 2004-06-01 18:01 Dave Yost
  2004-06-01 22:00 ` Nikolai Weibull
  0 siblings, 1 reply; 2+ messages in thread
From: Dave Yost @ 2004-06-01 18:01 UTC (permalink / raw)
  To: zsh-workers

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-06-01 22:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-06-01 18:01 zsh needs try-finally Dave Yost
2004-06-01 22:00 ` Nikolai Weibull

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).