zsh-users
 help / color / mirror / code / Atom feed
* How to save and restore traps?
@ 1998-01-08 13:11 Bernd Eggink
  0 siblings, 0 replies; only message in thread
From: Bernd Eggink @ 1998-01-08 13:11 UTC (permalink / raw)
  To: zsh-users mailing list

I'd like to save the traps at the start of a function and restore them
before returning. This would be nice if it worked:

   function f
   { typeset oldtraps=$(traps)
     # ...
     eval $oldtraps
     return
   }

Unfortunately it doesn't, because the command in $(...) gets executed in
a subshell (IMHO the manual should mention that!), so that all traps
initially are reset to their defaults.

Any idea how to achieve this without redirecting the output of 'trap' to
a file?

Regards,
	Bernd
--
Bernd Eggink
Regionales Rechenzentrum der Uni Hamburg
eggink@rrz.uni-hamburg.de
http://www.rrz.uni-hamburg.de/eggink/BEggink.html


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1998-01-08 13:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-01-08 13:11 How to save and restore traps? Bernd Eggink

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).