From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 242 invoked from network); 8 Jan 1998 13:35:27 -0000 Received: from math.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 8 Jan 1998 13:35:27 -0000 Received: (from list@localhost) by math.gatech.edu (8.8.5/8.8.5) id IAA04722; Thu, 8 Jan 1998 08:10:33 -0500 (EST) Resent-Date: Thu, 8 Jan 1998 08:09:50 -0500 (EST) Sender: rz2a022@rrz.uni-hamburg.de Message-ID: <34B4D065.F6DF5754@rrz.uni-hamburg.de> Date: Thu, 08 Jan 1998 14:11:01 +0100 From: Bernd Eggink Organization: RRZ Uni Hamburg X-Mailer: Mozilla 4.03 [en] (X11; I; AIX 4.1) MIME-Version: 1.0 To: zsh-users mailing list Subject: How to save and restore traps? Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Resent-Message-ID: <"eKekx2.0.191.T0Djq"@math> Resent-From: zsh-users@math.gatech.edu X-Mailing-List: archive/latest/1215 X-Loop: zsh-users@math.gatech.edu X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu 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