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

How to save and restore traps?



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@xxxxxxxxxxxxxxxxxx
http://www.rrz.uni-hamburg.de/eggink/BEggink.html



Messages sorted by: Reverse Date, Date, Thread, Author