Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
How to save and restore traps?
- X-seq: zsh-users 1215
- From: Bernd Eggink <eggink@xxxxxxxxxxxxxxxxxx>
- To: zsh-users mailing list <zsh-users@xxxxxxxxxxxxxxx>
- Subject: How to save and restore traps?
- Date: Thu, 08 Jan 1998 14:11:01 +0100
- Organization: RRZ Uni Hamburg
- Sender: rz2a022@xxxxxxxxxxxxxxxxxx
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