From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22879 invoked by alias); 8 Apr 2018 20:18:22 -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: X-Seq: 23322 Received: (qmail 27168 invoked by uid 1010); 8 Apr 2018 20:18:22 -0000 X-Qmail-Scanner-Diagnostics: from mail-pl0-f41.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(209.85.160.41):SA:0(-1.9/5.0):. Processed in 1.517718 secs); 08 Apr 2018 20:18:22 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_PASS,T_DKIMWL_WL_MED,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: schaefer@brasslantern.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version; bh=03wtES9eRq5escFIYfFxXOX3J26Fz6xcoVHDZWeKodY=; b=YOeH8Fgstl33dQMwNc73mm5Du7NVBX8tlA0EnFoiOJunoWTPtyGV/S9CijB5MFfvWV wqTh9AHF64fcL5PjMjF+BzmFHrLwyQbCclPh/LBqYFUzLjg0Y3t0+FTfWk0+urbvRPzA QxnyuztKIQAvXDJ5Pzu9omOJbxALL0Kcnc4Kg1vlH03eghHJsOlA5a9Ij5+25pWqRh4k wWJ0HLZ6MhIbXvIGnyoKLp8fE7NbjRmBN8yp18BKOQ/WPUIRSINklXGJQkeGnbVpmzfW fX9hpPpO+2Gw1IoI6apFSLHrTvqT8WUqCQpyzwtD/lb6hlofV7mV/lg2e6y7YAJfEsvV lSjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:date:in-reply-to:comments :references:to:subject:mime-version; bh=03wtES9eRq5escFIYfFxXOX3J26Fz6xcoVHDZWeKodY=; b=eaAhXWq0cQ5CadKw4tdF/1mbZaM+Ozf0uw+NVI3fymOeBUKD7wmeqMKqEJfZnGh2hZ 39zCXuURcXLTzbTRU12iaPKDpUwfCxRXyJweG9JpKq2cJVYT8r2+YauJtzqlICmDubL7 cYEZffC0T8/8ksBSRcFRukrHNEAPTAeb9UUPLbhuDgCjyeIFw+RLWuksC6SPPjJW4ISF XWTIVBPOE+kjpoVQrtd0dcItjwBtu5ZnzmKbsYFknq8KcDGrCDAVQE01BzZlECfyr+4m FweSFchS0U8TZsCjoLJeGgwUU9++WoZlRKVSgYj/pZuuOxabgHLTyevjoNuVkJ4NRhf/ 7PjQ== X-Gm-Message-State: AElRT7FusrdsmNIy48HBkuuaOrNLV4yajwpfuedCN6hm0lCq9AUUeOg9 EpU2auOQ/N4TI88p4X1Bgpqm8KOp X-Google-Smtp-Source: AIpwx493klP23rZbi04nx4ovr9mYa6UvsEhw1uq6yPV84xa3IfjXG1v2p16V9iH59PTgcqo5+EYngw== X-Received: by 2002:a17:902:2863:: with SMTP id e90-v6mr36573196plb.58.1523218698089; Sun, 08 Apr 2018 13:18:18 -0700 (PDT) From: Bart Schaefer Message-Id: <180408131814.ZM7928@torch.brasslantern.com> Date: Sun, 8 Apr 2018 13:18:14 -0700 In-Reply-To: Comments: In reply to Ray Andrews "Re: activate alias inside subshell" (Apr 8, 7:56am) References: <604319cb-d86f-686b-ac9b-00d21650edff@eastlink.ca> <637434d9-ff23-53d4-5d31-443942fc2ef9@eastlink.ca> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-users@zsh.org Subject: Re: activate alias inside subshell MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Apr 8, 7:56am, Ray Andrews wrote: } } Is 'zsh -f' the answer to the above -- a truly clean test of something? The first thing asked following most bug reports is "can you reproduce this from zsh -f?" So yes. Start from -f and then load the minimum number of changes to try what you want to try (e.g., add extendedglob if necessary, zmodload zsh/parameter or other required modules, etc.). } So: } } $ alias msg ... ; test2 () { msg } } } and: } } $ alias msg ... } $ test2 () { msg } } } ... are very different! In the former the alias is 'pending' in the } latter, it is active, yes? That's easy not to know. Yes, that's correct. "alias" is really intended only to make interactive shells easier (reduce typing), not to abbreviate scripts (even if the script is going to be used interactively later). } BTW, results are hugely different if the redefined message function is } redefined with or without 'function' prepended: " function msg () ... " } vs. " msg () ... ". Most comments found on the internet suggest there } should be no difference There's no difference when "msg" is not an alias. But in msg() ... the word "msg" is in command position and therefore subject to alias expansion, whereas in function msg () ... it is *not* in command position and will not be alias-expanded.