From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7581 invoked by alias); 4 Apr 2015 18:49:15 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 20085 Received: (qmail 14955 invoked from network); 4 Apr 2015 18:49:04 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:message-id:date:in-reply-to:comments :references:to:subject:mime-version:content-type; bh=Aed+xUpACWUH4MGsDjbxqSoeUTmiSo5vst5VEsqJDnc=; b=ep/wqiXulqWpx+xD55+ANtH0Oxo4ygYgW8kDMGYW1Y/UNb2WmxIjP0dX9nffQi6L5Q dkwJxaPIfoPrnU7QeWnIfb9qTVCHvhHW/U52uiAYgryIAdyn8j4UxRRBI8/QiHTsiRBJ 8KVyRjpQCxRuffvRU+1Z403HGc/3bVcNgGryXzoSat8Gb9mhEOF1909vEIoP5TOoGTgW EvDQvAeR8/7TZNRnMLSok/s8PrOTtyRA437ZcbU2CCZuBGSepiPm8W8X08ywQxe7e6iv km9MdGi8BpnkIywXebSHo5kKrDPxmPlHz7JwbtuV/npcNYxiagmXV+3fMKSPjrITmBTm VSbQ== X-Gm-Message-State: ALoCoQnGLQpOat+Q3u1Mnh52bjdpfKjD56DiTUNj0a4HIoURJbuwIlKGpAWZQ0l6+oQsHOrInHOe X-Received: by 10.183.24.168 with SMTP id ij8mr9783773obd.15.1428173342719; Sat, 04 Apr 2015 11:49:02 -0700 (PDT) From: Bart Schaefer Message-Id: <150404114859.ZM14898@torch.brasslantern.com> Date: Sat, 4 Apr 2015 11:48:59 -0700 In-Reply-To: Comments: In reply to Thorsten Kampe "Re: How to trap EXIT like in bash" (Apr 4, 7:43pm) References: <1428167314.5875.2.camel@niobium.home.fifi.org> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-users@zsh.org Subject: Re: How to trap EXIT like in bash MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Apr 4, 7:43pm, Thorsten Kampe wrote: } } elif [[ $shell = zsh ]] } then } trap "echo trapped; exit" INT HUP TERM } fi } } Then Zsh does actually ignore the kill (TERM) signal. It doesn't ignore the signal, but it may not run the trap either. You need the trap on EXIT in there: trap "echo trapped; exit" EXIT INT HUP TERM That's because it matters whether the shell itself gets the signal, or an external job that's been run *by* the shell gets the signal. E.g. if I run a script that executes "sleep" and kill the sleep, the TERM trap is not run but the EXIT trap will be. If I kill the shell itself, the TERM trap is run but the EXIT trap is not.