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 12935 invoked from network); 14 Jul 2023 16:42:50 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 14 Jul 2023 16:42:50 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1689352971; b=LjZJzAJ+/J/rt7ulCANTnvy9+FC04MDxo02C3IQNR81lrcQ+rHwr1gmvYxQdTA/bNI5LTBOCxM ZxO/0LWeo+BcqTczO7orIXhQvfXd6kU07tEwO5e9clFpMh9L98fgjE6YV27G+JDrH4FzqAh9EA e2cOR/EDuR4E8x7emof0bY+7ybDDlTEr2VHL2NrxZQZ+iqqzurgXcSNPLlN05gxczAB39SqH3J j39M3CnvfSC96mxP6u/C+LL/xw/UJROWv2DF6YOU5Tz9kHtf5xJMMpUVI8c0vIvogqidmd49cD B4y3uUN0KzQtuibLl3VTyzkk/7tVPD2IT2AaGYk/LQnobA==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-ej1-f44.google.com) smtp.remote-ip=209.85.218.44; 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=1689352971; bh=q7qiEUeRqosT3gV/dbTNmhKV32v9cNCfQXX48NLnewo=; 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=N/BeKbuc9Kyb3aQYj2HmVizzV20TLQ2s7y10XhhGqCWx+WiwrRRm6b1pEcqDtQ034zPBEI8iRv osrf70JTva/Gk3mUA7h1hHVP0YAMBAMKFZYQb4DLrFiYCTafgn7EPqiz+QldZLr06MuhIe2Vn/ M/mxLJ8Jl3OYYWWyXrS9546Vne2aiO1umoIxclBEQupXW6K8o4h/Oyuf3OkE9gNkTwr10kNuIw g8IdMeHtzdXAkYfLs/slp5rk1I+vcIBE+4mFRQnUUmP8TUI8axTo0Ra7LSl6qFZXJpBJLlpYWt cZUSuAoYYNUb741iTF7gwHf9neO+SYm1lJX5Cln6qxYk6w==; 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=R+9M6NshZSgL0Bsg1sn6pEf1EW7CpkPfP14xUsmLLOc=; b=S5O6MlGNmIdF3qeHFR6Jr8J1XW aWZZrh5lUYV6dNYGYbIQ/+8mYEBbQxvElHd6JL2eEA1kVcfi96a4KWnmwSsIbUAOXw/wANJEonopX DUGkWehJNySeg2llSMAXB9rW0BI1rk8xGaeLOVUHVFNe+1BqEz0lzvtr3jQrDpLaaqHZ7fU1Q0UCf El/J5fPxnHOKZUWiEMAOkWHPFq6J4aLIh1RKQvfBexnL2biNlY9Ux38KgXNaQdF/NeczbT11l6esS gHyIDgYJbKpaLEZtRtMHFVY+2gOu1UMeEO2W7+0u5Ng4mprpwFx+k6rjn/uROmpIfHWQzmpnfhH7a SlfDueqg==; Received: by zero.zsh.org with local id 1qKLsY-0000CE-8S; Fri, 14 Jul 2023 16:42:50 +0000 Authentication-Results: zsh.org; iprev=pass (mail-ej1-f44.google.com) smtp.remote-ip=209.85.218.44; 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-ej1-f44.google.com ([209.85.218.44]:47218) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1qKLrw-000PRd-Dq; Fri, 14 Jul 2023 16:42:13 +0000 Received: by mail-ej1-f44.google.com with SMTP id a640c23a62f3a-977e0fbd742so289057466b.2 for ; Fri, 14 Jul 2023 09:42:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20221208.gappssmtp.com; s=20221208; t=1689352932; x=1691944932; 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=R+9M6NshZSgL0Bsg1sn6pEf1EW7CpkPfP14xUsmLLOc=; b=3NvZWjg7kf8fdDm24Y04dbhQ6AIlHqnPKT7cxP38zlrdGCr9bxjVygfepvnwnLCjNl Ne+VzR/YDIbMvyNs8UuDbSyJ2xjCOzAQJ65eyfQJo7XtXNR/OskzB7/NyXhStXoIPhYp Ii+GAsBo/W13zYYA4YSI6PsxCU4Bin0XqQFowErklkZXv8QZNKDKuiWvHI5uRahl8wAU M0lILNXfVNYq0EDRiO9oxPXNuEcrCt991QRbQezcgdrs4ThhIAt5LegC/8egwnI4y1Lj pfAUUsLEQuThgd6DSmlVq7fTiZT0rdl4BFkP8ZGBDGkvZ9m3Y1Ja5JCUgM24co7g391p ZNSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689352932; x=1691944932; 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=R+9M6NshZSgL0Bsg1sn6pEf1EW7CpkPfP14xUsmLLOc=; b=DngIg2a3luKjtt8Aim5d6I3nYlLlB7VXwaUDUQmT4UsS4NTP5FruDm3U9MGQIByh27 EskwLeGtE60l/kb/adesfhJMBfC7bRwzmZ/QO1l85Xzuz9PufhKfFuBTMq+oW66Y9V0N baKXHtvJcusfa1uC8hw6oYmdgrKZGIQHQ72tgV756AfmDvNwA0EBtSnUi14Xq81WaItF Sy23xkCJAt6GQ7ipucxgYJQdK/sEe0n5gHDC2+6EPSqfapce20FLC2c18rhcDGrtpCrl dtPnNkM46YeEH/AO44LFaFPAytBKZSrnuea2UQQSa8elVV5q269Rw9TIsO+mrPuAfiqj o16g== X-Gm-Message-State: ABy/qLbroJgKEawQoLozBZ1LVTH9ZI/ZjeSawHO518A6H/W+yTdGpgQb ROEvbwHe8Oa2AI6V+vsW8HbO4/58AzEostOfvBA8aw== X-Google-Smtp-Source: APBJJlHJJXe6ctWMoT2ao9fH9T0AkEvNWSS6jgArFfiin9ekrE5/BsNj/lKvtAP/Y36vMCB1o3Az6Jdr0Y0IK7HWDF0= X-Received: by 2002:a17:906:518e:b0:994:54fd:31aa with SMTP id y14-20020a170906518e00b0099454fd31aamr1069211ejk.15.1689352931871; Fri, 14 Jul 2023 09:42:11 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Bart Schaefer Date: Fri, 14 Jul 2023 09:42:00 -0700 Message-ID: Subject: Re: alias/anon_function quoting issue To: linuxtechguy@gmail.com Cc: zsh Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Seq: 29108 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, Jul 14, 2023 at 7:47=E2=80=AFAM Jim wrot= e: > > Note: This is not critical, just annoying that "I" can't figure it out. Here's a little trick for making the shell figure it out for you. Step 1: Define the function you want using a placeholder name of some sort= : function foo { Var=3D$'\e[' } Step 2: Define the alias by referencing the $functions special parameter (which contains only the body of each function): alias foo=3D"() { $functions[foo] }" Step 3: Delete the placeholder function. unfunction foo Step 4 (if you want): Confirm the alias definition: alias foo The shell will use a bit more elaborate quoting than strictly necessary in some cases (and for some reason $functions encodes the body with a leading tab character, removing that if you want is left as an exercise) but you shouldn't need to worry about it working. I can't think of a reason to define a global alias as a function, but be sure the placeholder name used at steps 1 and 3 is not a global alias.