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,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 2809 invoked from network); 28 Jul 2023 21:54:51 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 28 Jul 2023 21:54:51 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1690581291; b=XPZE6LsC7d3PE1MrwvkU6NT8DyzRkTXWXGSTVRWgul7d8dTFZNnNA1NA+JN+0v+3oLTEeAtH3W mZHxKwEdnC4DTTwt+cqKpO/D3s/Wv04n1sJsTVc5daISRarMU4paVqTrGZ5QmBqamCd1QCgMgZ nPUGQIJ8glllvEH19uXlmZ41SZmBdeW/x32FnHrj94R8YOifkcGh5ZI58uDcP6GoM6rQmPQndX 3gV6/g9nM2QFWPjNbSNstgsC2tn+7IDZxKniQSWn76rJYl7/UPWzq/9jU1jsARztyUwXiQMePm 4DYhBrfst1TKbULoBS1RTZhbA7BlWRjN41x16BifpKWtxQ==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-lj1-f176.google.com) smtp.remote-ip=209.85.208.176; dkim=pass header.d=brasslantern-com.20221208.gappssmtp.com header.s=20221208 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=1690581291; bh=nPW7CTmMpZq8jUVyqlOFLDY91vNTJCQOk969fwmYuMQ=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:Cc:To:Subject: Message-ID:Date:From:In-Reply-To:References:MIME-Version:DKIM-Signature: DKIM-Signature; b=jlhyPyn7pYGJgT/XZz7PQSgITuDcFvVbqwkFuPaXs9uaKJoV2ITpBcX3z0sRq8YuSM2py4ljs7 4+tFZPwa4GQngUECmnLNRlSaGcU4iBHxWvE/hdxXDQT39ePisUWFYpqdqHWA2Gmx5iM1Ktjgji lYFIdZaJE+bU5puf3i9gnx5MfEGHdPQCwBEpcPfJOUU7rQ9MyFWpUNo3LHvI0i2zoSWdYQB5ox 0BvhgXcrb8ecp3ddYX1SuHzHYB0LwYp7+uzBoX7yFdRArbdkS0iOMGisIQic0WyG4sheSJEtY6 y/jb8Y6ZcCWhi7rMPV9cLPuTEgaeubpugv8o3qtC9dw0GA==; 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-Transfer-Encoding: Content-Type:Cc:To:Subject:Message-ID:Date:From:In-Reply-To:References: MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=YS4msC7yLnp7+ud1ttqmtuvI1lwOJOb3byuUQoGbJQQ=; b=ZUgZ4SHcTWDyXWKzp+n4TXd5gi W0il2uhHLDQz5mWnxTceh1b/6MA7qPM8LtQdeGHaeF2dBqxcjVx2GO1kNToVcZ47VkzV4ZT5h5Mkk 629QftiqRiKFzwamIpQhK2aonWZhf6UO3xEX7wJj65YOl//rqZruqpt7fh/+PR5attG5FofTs9LVb GeBour4bU8vkDnXgb6S5C229UfVubupJHKFlF3Jpt6gj0w2epA4DbZZgS/xEi7DR9USHA/GezEkJ7 QMs8Xa4+HdT8JyarT+vIIJ59loSCOnN/T+P4QtJDZK/DgoUZxZAZJ8TmxExmmfc6weAfZkIP5VjQL SiAdtf+w==; Received: by zero.zsh.org with local id 1qPVQA-0008ho-Nx; Fri, 28 Jul 2023 21:54:50 +0000 Authentication-Results: zsh.org; iprev=pass (mail-lj1-f176.google.com) smtp.remote-ip=209.85.208.176; dkim=pass header.d=brasslantern-com.20221208.gappssmtp.com header.s=20221208 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none Received: from mail-lj1-f176.google.com ([209.85.208.176]:50314) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1qPVPQ-0007yN-2i; Fri, 28 Jul 2023 21:54:06 +0000 Received: by mail-lj1-f176.google.com with SMTP id 38308e7fff4ca-2b9b9f0387dso39906521fa.0 for ; Fri, 28 Jul 2023 14:54:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20221208.gappssmtp.com; s=20221208; t=1690581243; x=1691186043; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=YS4msC7yLnp7+ud1ttqmtuvI1lwOJOb3byuUQoGbJQQ=; b=UIbsBu1eWBMmhtij7I7RJVBulF9X0vGJ1+MlMyU1aBqbAnj36k5tjMjTUMiaVixMpl MtDnpsUNXlhzceZjl5Hq4GU5WSYDkeLwGERbf7AxBIUJq+kOBLAzTK6UqViPGLm2ZH93 KXK8jPRgpfC4w80Yv2+FKgCQF4R4oDmvvOIB0WQcui1Fm0bDU6QWXBEB/Jvx6lvZCXWE ColLkvz5rdBYnBUbZntGGJhEk4UyeG1e0lgmul0K3NesPPzXQI68lawUB7M5mxW5fEiA zl+gxymOgtz/8BLwcb/VVe/NHBSg9eJIotqPBXOgwyyz+1jEAhyRR4OzxgyC0p86HXpP QNww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690581243; x=1691186043; h=content-transfer-encoding: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=YS4msC7yLnp7+ud1ttqmtuvI1lwOJOb3byuUQoGbJQQ=; b=DUZcrrNc/QwqSG5EcDUDdw3nwI7GaHUIugJGmGKdfz/ZKPoNyxibHe5NQ2S1AztPNb /PxncljW2Scc6Xc0+yhazhCE1a8oCM6/B5Y5kMgzbAWRiqFZTrRLrCbRdsNL+TiBTahh opFOdmgjkZgN8Dxoa118ViuC/7wRQQ5JCc5OfeBxwPqnlMZx4p0TW9KK2jbf0y7ZouHk zCiCXp1Oy7EIru9HsnuwN5PvEj1szs+vafehvZNFV+40zszclrPosp0g6DW4gGsjfS90 TAvLIBX9S+ewEOcSJ/qeioxhzBMS+pwQvzUZV0chq146Crf3D1zWh1U0SdyV3+XOuEn9 QV+g== X-Gm-Message-State: ABy/qLbygF1eyzpy5QGG7zn/ir/mBJVpf3bFQBOr9VnegwDeX+U1Zzaz E6R1bW93VGzibwWgaNiqNOEpy8DBF0M4Bx5US7w/XpMcdKWBMnwd X-Google-Smtp-Source: APBJJlHhKYtMbCLBUdDAnfJZcVkgaw0WgIqS5TUuLmVFsjkwis5yk836xmJzYQZJItM6FRYzFIx7bzsgCvYnZcA+IM0= X-Received: by 2002:a2e:8782:0:b0:2b6:eeb3:da94 with SMTP id n2-20020a2e8782000000b002b6eeb3da94mr2767977lji.22.1690581243171; Fri, 28 Jul 2023 14:54:03 -0700 (PDT) MIME-Version: 1.0 References: <94d698df-95f6-5d42-0402-5b46b7152463@crans.org> In-Reply-To: <94d698df-95f6-5d42-0402-5b46b7152463@crans.org> From: Bart Schaefer Date: Fri, 28 Jul 2023 14:53:52 -0700 Message-ID: Subject: Re: alias/anon_function quoting issue To: Johan Grande Cc: linuxtechguy@gmail.com, zsh Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Seq: 29116 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 Thu, Jul 27, 2023 at 1:51=E2=80=AFAM Johan Grande wrot= e: > > Le 14/07/2023 =C3=A0 16:46, Jim a =C3=A9crit : > > > > alias name=3D'(){ ... }' > > Hi, I'm curious, is there a particular advantage to doing this rather > than declaring a function? I can think of only a couple. First, you can define a suffix alias this way: alias -s tgz=3D'() { tar -tzf - < $1 }' Second, with an alias you can use simple quoting to switch back to a command of the same name. In this example: vim() { gvim "$@" } \vim foo the "vim" function is still executed and you get gvim. But with this: alias vim=3D'() { gvim "$@" }' \vim foo the alias is not expanded and /bin/vim runs directly. If there are other reasons they don't occur to me offhand.