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.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 20096 invoked from network); 26 Nov 2022 15:25:59 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 26 Nov 2022 15:25:59 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1669476359; b=LdDOLEaVbtiYcjcX2sdsCXnoYzPTqj5NC9JFaEewnCW/T6Wi7zmXY8p13kNpgRfgoSI0L9Aypi S3DWbVaPyNf0Rg/O1svMsZ3DzijRvQF3piQ6XOwpuQpbQeeljoMRl3EXPuZyPRL2EoPPsyTlw1 FfjrcHbsPRvoXqLFqHxZlBaQrj1sHDEvpliipb/bNnY/Ce+hOkkZf12y0J6GmbBqUBZcbLVFtQ ZQR6Sp/Vh563pXN2BzyvWCIPkJA60TMurug+QMNBzg9WKIa+eTJL1zaHKTghzmKALWOSGzu8Fh +TnQW8r5bPXXucG5eLVq9HGiuq7S71C3zHpYp3WfDO3lSQ==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-yw1-f169.google.com) smtp.remote-ip=209.85.128.169; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1669476359; bh=JKgvgOu/dUObYkCsngHCQcRN38wSxl702Gl4Vhewv/Y=; 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=CdeJnKJH9IgX+myNiOXW2o5AhLzgAkmkop1o0TC77/P+dlB/j1FVDP6ieNLm6eXPc+fKlXkk+b 1GjybzBijxqJUYykyexv8A1NZf7kWDMOq8ZjF36SFYN//5koxt27Jk9+atUGHO6QOpPAEeC17v v/abxUw/re1paUu031pMvzQ46+/FaeC//MSX23MExzEwUKTgb7iDncpPnv3xXOhQ0Imak6a9Bk Mxkwj8sDY5z8nBN8jGMpsEKyIieMAd88+icfh9gBm2BGHsi3a4Fmf5c70DCCXh/q6nG2WQ9iVJ Vr9z4aT1exW5Y0+M1xu/9wi4X/7ldnUiZcA5Lze1ehhzzQ==; 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=QjZIt9G27BkOQXOMJvd+zGpQmW7nUhJOV9shoJ2UB/M=; b=q6IE9Z3ZcYWJqQLI3cjwHYhhZ0 cVzi8vzgTeSUZt8qt6unhefySkQIEBMS8RazDQheIehEFLnE2XT+4IutBzrotwjjqeTwxpr8hqczZ d+9SyldfcDRr53AvYp9kkR/grQyN89UMXE/poaNWjmoiB72wa/3e3Kn3OciLutb/Q3cGTgih/iA3x QiNh95Sx6oCuKSSUslah5tWzWmWSivNc2EsgKuUxFr3EFU8gCdYKl9tn5wvvW3hO0DroGLIEMtPvU TugiOg4grppTtEFykEoIGz827U7PqSQ8tzxV/3ITT1WqjReVXnvfDKGaEhaLaP4VebCS3FgO0p+kX Gv1uaaKQ==; Received: by zero.zsh.org with local id 1oyx43-000O5i-HL; Sat, 26 Nov 2022 15:25:59 +0000 Authentication-Results: zsh.org; iprev=pass (mail-yw1-f169.google.com) smtp.remote-ip=209.85.128.169; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-yw1-f169.google.com ([209.85.128.169]:42600) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1oyx3W-000NPq-6s; Sat, 26 Nov 2022 15:25:26 +0000 Received: by mail-yw1-f169.google.com with SMTP id 00721157ae682-3691e040abaso66331767b3.9 for ; Sat, 26 Nov 2022 07:25:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.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=QjZIt9G27BkOQXOMJvd+zGpQmW7nUhJOV9shoJ2UB/M=; b=QAeSxYtxl0pK/Mf5b5i/CDhdSdjqu98DphJklNAJwEqf3zw8QtPteo87CjcZwXPfWz ac94fNydMTOS7S8PUp4jj0q/RVbSUF9KpRL5zdJ4MAUu/UZT2w/g0d5r8/yoy0WRIVUc Crl9ZSpd3DFB6wXO44vWxVHPNCpukoibmI4+Su4o1HzDLLi4P/DhG+NPDhC2KvekjPps uuR+ptqPg8AeZiBxrXVi7FfhOumYhDvBjHu946Jx4rgQOOyyrxW8YGlTAwuO3zYvR0vr BN2MK3eubpvLXg2378dcok0uH2sjhz4yITjQ/D/dTMXEboW5sFUcpOMSq7UaBeYoN3hS 7lXg== 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=QjZIt9G27BkOQXOMJvd+zGpQmW7nUhJOV9shoJ2UB/M=; b=oQSCNBu5UT+U2YYYm94nAW8orOyVN4mgfKJfiMWOXgVBbeh/irSdamIOnJfDJnfrFS oNfQHWTW/HSR2KQYIMRRQFM6ZS8YbYnlijaQO+AfGOpYJxUKJwgS1MK7y4VQcdekTdLw 8iRB/IPUinZRysTSaM4TFbGmKNjNjVaQYNn/+fDxGbgBe/g1zDZuQxQBZs2ZwYc1LLG2 do/DYq4jF+kwqKOtARHhN3eHwhTZabB8QXRKDrYl8lRDsivVCxXS1QjkfOVQQznToSCh ihXwvbQz/JsGqW3K9AnSZfXEsZ3zxhnyzLm5T35CUEYZh3+EDEAFbNwZD2AcPplLHoFB OtKw== X-Gm-Message-State: ANoB5pl84cibH7DVsaRZCIqEgOHsY16YPJLdeFDpo+jUYk8xGLLpRhSp RYTdo0M5pwOm/v2IrExvyQuLEdOPfGG2+mwv8bQ= X-Google-Smtp-Source: AA0mqf7TEM1SebLiA/4YPQxRsrlh6gUbrttrIBwaWj6Ip6KxDVTL7DPs/B2ueVqPPw7pY8b0nhxXLq0GL8Fb654a5y4= X-Received: by 2002:a81:160e:0:b0:3bf:c5fb:2550 with SMTP id 14-20020a81160e000000b003bfc5fb2550mr2647775yww.286.1669476324823; Sat, 26 Nov 2022 07:25:24 -0800 (PST) MIME-Version: 1.0 References: <0587d081-5941-2634-80f2-69ed537de651@eastlink.ca> In-Reply-To: <0587d081-5941-2634-80f2-69ed537de651@eastlink.ca> From: Roman Perepelitsa Date: Sat, 26 Nov 2022 16:25:13 +0100 Message-ID: Subject: Re: trap question To: Ray Andrews Cc: zsh-users@zsh.org Content-Type: text/plain; charset="UTF-8" X-Seq: 28436 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 Sat, Nov 26, 2022 at 4:04 PM Ray Andrews wrote: > > I'd put it the other way: trap and eval are both special cases, no? Surely the general rule is that nothing is ever expanded within single quotes? There are no exceptions to this rule. The content enclosed in single quotes never undergoes parameter expansion, command substitution or arithmetic expansion: $ stays $. Now, what you are going to do with the *value* that results from the evaluation of a single-quoted literal is up to you. You can certainly decide to perform those expansions. foo='$(echo hello)' some-command "$foo" The first line doesn't expand $(echo hello) but the second command might. Maybe this command passes the argument to trap, eval, print -P, ${(e)1}, etc. The command doesn't care whether the argument was created by enclosing something in single quotes and in fact has no way of knowing this. It only sees the value but not the providence of it. foo="\$(echo hello)" some-command "$foo" This second snippet is exactly identical to the first. The command will receive the same argument and won't be able to tell the difference. Roman.