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=-1.0 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 25837 invoked from network); 29 Jun 2020 16:26:16 -0000 Received: from ns1.primenet.com.au (HELO primenet.com.au) (203.24.36.2) by inbox.vuxu.org with ESMTPUTF8; 29 Jun 2020 16:26:16 -0000 Received: (qmail 19889 invoked by alias); 29 Jun 2020 16:26:02 -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: List-Unsubscribe: Sender: zsh-users@zsh.org X-Seq: 24961 Received: (qmail 8960 invoked by uid 1010); 29 Jun 2020 16:26:02 -0000 X-Qmail-Scanner-Diagnostics: from mail-vk1-f179.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.3/25857. spamassassin: 3.4.4. Clear:RC:0(209.85.221.179):SA:0(-2.0/5.0):. Processed in 26.608897 secs); 29 Jun 2020 16:26:02 -0000 X-Envelope-From: sgniazdowski@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.221.179 as permitted sender) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=jYOcdchUPyqP7AdGPe3IoQ+SawQLNUTbwBApTOmi/Hk=; b=Cjic+qVj9KyL8XPwSn7yyaTvV3rrX9TpaKNPUyd00qm7skCdt9FdaMgR8vDs8WdtUE t+HbEmPFh4fCDwHc47vygyuB4tC6r+AGQHC0DfrYOA30skRYDse3j+U12Ta2cNNQnTVk 7mqPBOlQGVwtSfKSg+IbtvL8vIIbKHdB0jQD2HM14odJkIWtpRaRGyrgl4AnoTVNF/ym bdfVCSQmEY3m8PT5iQ5tvm4gIOizl3XNSTlc5XQKg/Sw/c+TGz8ofCMPGH1qSqXjbZdM kcfJWb0hrvlrS2C3CwATRa5hU5wLoBhgn7pKQI9onK5RBUMrWcJUCwjBK2969u29YBSS AJvg== X-Gm-Message-State: AOAM530oU/HtVrmdAPWHa/r18y553Szx32K0qky4qN8Jk6uPKaYfAJ1c fVdAFcDd2dI2mFvZ4Zg6ZpOUREVcQRNdFCncUoY= X-Google-Smtp-Source: ABdhPJzcemTndghbTMl9jZ2jlV0+4JcxI0C++5c3fLu/0itEwDp2uYO1XfHaXn0T7dszBor3X3tBc5l9eM2kTwoKEHM= X-Received: by 2002:a1f:add1:: with SMTP id w200mr6204106vke.22.1593447901213; Mon, 29 Jun 2020 09:25:01 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Sebastian Gniazdowski Date: Mon, 29 Jun 2020 18:24:56 +0200 Message-ID: Subject: Re: Alias call in function fails... To: Mikael Magnusson Cc: Frank Gallacher , "zsh-users@zsh.org" Content-Type: multipart/alternative; boundary="0000000000001eb73c05a93b8036" --0000000000001eb73c05a93b8036 Content-Type: text/plain; charset="UTF-8" I once was testing with Eric on IRC and the aliases sometimes do work within the same file. I think that the distance between the definition and usage is important. I wonder why? Are the scripts (zshrc in this case) being parsed in an advancing manner? On Tue, 23 Jun 2020 at 01:25, Mikael Magnusson wrote: > On 6/22/20, Frank Gallacher wrote: > > Greetings, > > > > I have a function: > > > [...] > > > > Which calls an alias: > > > > alias dumpit='hexdump -C -n 128' > > > > It works fine in bash, but with zsh now I get: > > > > :::::::: test.txt :::::::: > > dumpall:11: command not found: dumpit > > > > Am I doing something wrong??? > > Yes, don't use aliases for anything but interactive usage. Eg if you > want to use dumpit in a script, make it be a function: > dumpit() { hexdump -C -n 128 } > > Aliases are expanded on parse time, which means aliases defined in a > file won't be usable in that same file. (Because it is parsed in its > entirety before any of the code is actually run). > > -- > Mikael Magnusson > -- Sebastian Gniazdowski IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zinit Blog: http://zdharma.org --0000000000001eb73c05a93b8036--