From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 15653 invoked from network); 26 Nov 2022 01:58:20 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 26 Nov 2022 01:58:20 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1669427900; b=ChqvkLoyogjnlcrkrrbzYpSWZzVrnuCq6EtNJYg9OyvVcuATE4dNnt0/gNz1A/4utY8eM90RbN m/ySwKEJppCcwv4v61a3nD4uY6HIOuebWSXp4/aQwROvgOgeylOxmiPUIuMsMNSIvvoUnw0UdG xY0HNH9l6P2h7wq0/p7B9LA2JJxwg1aYHJxskp+pDwItbW10VjpZcuPEStAipadj9fbfnNIPkS hHumc5U3/bixxu7r2VIwvIufndFsceUXy6nKMTjWXNAY4pWkITFM3MTkYxrYb6n6+IsNUUTquy ZUJHdlmFMefBpqFPlsyigUHKpFrHTho96Zp39tkjYyHxxg==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-ed1-f49.google.com) smtp.remote-ip=209.85.208.49; dkim=pass header.d=brasslantern-com.20210112.gappssmtp.com header.s=20210112 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1669427900; bh=VmKYcQQUm/ZXQCjiIt6nBmY/Sk4YMj235mMGoxgCC5E=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:Cc:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:DKIM-Signature:DKIM-Signature; b=XM02b5fAayCNvmSCPC3gffaywBsP9CQEuB35j2xspVkZzvmzUZ9FyF1elzJrPdUZOzwHBxTlR7 LD9ToTmYqNBsqXgq4J8ZgSV4XbSb164FP2ouaUo1TVhoDpGbdLzBdO1kqBKi0Xr02AwbeDNG30 vDA2crk8IwE8fqyzO4H7+vsOTBU1+T6XyaPZV7UN8BFFmrP3Dsj9zTN1OMO3nLfEy222plOhOe hPsKOhRjFUoBIRAaWRI7uArVPo3WSAtLYDuG7zDmN3vV719UhGmwYr9kltEno4URGgS+6Nj8w3 WBjhsc4oXuy9uMzfjARI6qPk0HAo0/32exPqwh3RB6pXZQ==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Type:Cc:To:Subject:Message-ID :Date:From:In-Reply-To:References:MIME-Version:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=PcCRPAY55I1nbVcbpreXRB7v0qaQzKsfg0/zTBze09Y=; b=S0xAhLBlnU3IbzZ/Scuk9OshNa inm6GRk7Ow/d2mAOjPoWuvar1WiM1Cd3V6+OwnbVdnKn+jk4NnW1yzTl4ADgCPLeLjguj7JYBKOvT WUR46kKHE6pwzcOtUKD3ZHTrFty/v+p/uF0MrfXjouamx8X6xtDeZOq2PDubiAXFH+8TZC+5ZVqNZ 4+LRpAcnYQv5O7zCFLe7b3lpnrX2wMYAHvKQrQTL+oziDwFBda+W3yAxDEnd1p5YcrJMJJLNrHJHL k7W7rPou0+9jHhGMXBsu11t4NF6C5tWbU/nd6FO6RVWCuDLL0yE7fzmM0a/aRS5qrqQZV67b97tav Owrpr6PQ==; Received: by zero.zsh.org with local id 1oykSR-000JJX-DS; Sat, 26 Nov 2022 01:58:19 +0000 Authentication-Results: zsh.org; iprev=pass (mail-ed1-f49.google.com) smtp.remote-ip=209.85.208.49; dkim=pass header.d=brasslantern-com.20210112.gappssmtp.com header.s=20210112 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none Received: from mail-ed1-f49.google.com ([209.85.208.49]:46991) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1oykRW-000Idu-1x; Sat, 26 Nov 2022 01:57:23 +0000 Received: by mail-ed1-f49.google.com with SMTP id z20so8418079edc.13 for ; Fri, 25 Nov 2022 17:57:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20210112.gappssmtp.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=PcCRPAY55I1nbVcbpreXRB7v0qaQzKsfg0/zTBze09Y=; b=MhFUNHoUEOXoEf0H7BCtUzzxkQH2h2+zC2rBjvnM/cwld6ni48JnB7e6a6gNPQOFDf 6Wg/yclIqk4SFt9eqcipLnEYhXW0xeYCNAmNQHwrRCkimf2rcJYYoikuJhnZBBZzcClC POV++MCPueHFhergV0wmGv5MaJEG82SI2169QpW6tYe3WhqUvaFamMn4o9groCgi4nHw X2Qh04SVMdKEyOjMTOG1s9bdNasOdFgepAISpUukvgd5Hz5N+kdMv7S1RNG6FPCCNoWd R8bMaQQFoNln2XmiY0zv1UKKL5kKqTFwXTWjnFnKmUdhVgIvp2x/PeYaWqQxmCBFG3ZN XCpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=PcCRPAY55I1nbVcbpreXRB7v0qaQzKsfg0/zTBze09Y=; b=N8V/YFp2C9ABiEotJGOEMUeaYuMVGrLWbJ7Hc0xf+lWgUm5SVttRIGZkE0+n59jIf3 kn+8eNAYb1fHbBkG7uGVgh8t5jya/LdeTXwhTgglOJkkT2lTtsGxvKHHodvAtmin6mth qm2SqLjaJPTtjCkBQxEjPPjXDYRsBFVvbS6ET+6EgcxxkI2EeX/PjrjysZVai7T+8PvL khPrqBVijOaIgJZJ9USFuF4UHAhxBhOvckc3oGZz2HdHv/c1VpU2x/9rPKzaZyaYr3F8 i1kGTdP+djiCUuDp5bPTwHMidxe5dvh1R1n0MsWMyHS3l+A8yK7e6nYwz8Tq7Jj5Ayk1 zSXQ== X-Gm-Message-State: ANoB5pkNPAk5886R7C5are82HIKuAOxkqDJtxR2QlEHJ6TXF6YwfVYrU dqY0l8zt82jUWeUDj1jaztklJXJCqwgdAQknVnaWmA== X-Google-Smtp-Source: AA0mqf4unLQzr9N+K0x6EH5+myRiPMKE/Mr2fK8jTeJpJO06sw2ec05fYcU+p9Hn8wZVIyoJllzCKdwy5DgkY+oilHI= X-Received: by 2002:a05:6402:4286:b0:458:7489:34ea with SMTP id g6-20020a056402428600b00458748934eamr25137260edc.264.1669427840960; Fri, 25 Nov 2022 17:57:20 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Bart Schaefer Date: Fri, 25 Nov 2022 17:57:09 -0800 Message-ID: Subject: Re: trap question To: Ray Andrews Cc: zsh-users@zsh.org Content-Type: text/plain; charset="UTF-8" X-Seq: 28430 Archived-At: X-Loop: zsh-users@zsh.org Errors-To: zsh-users-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-users-request@zsh.org X-no-archive: yes List-Id: List-Help: , List-Subscribe: , List-Unsubscribe: , List-Post: List-Owner: List-Archive: On Fri, Nov 25, 2022 at 3:25 PM Ray Andrews wrote: > > Double quotes evaluated when > parsed, single quotes kept as literal until trap is sprung, yes? Yes. > wouldn't have occurred to me since I'd have expected the '$var' to > remain un-expandable within single quotes. Is this an exception or > somehow to be viewed as routine? You can think of "trap" as a delayed "eval". > BTW, will this trap catch exiting > errors or just proper returns? Depends on the error. If you have "setopt err_exit" (or err_return) then the trap will be tripped when something returns false, but if you have "setopt no_unset" (or use ${varname?message}) and reference a variable that isn't set, the trap will not trip. There are also some circumstances where the parent shell will have done an opportunistic "exec" of the final external command, so there's no zsh left to run the trap (this is technically a bug, and will eventually get fixed).