From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8906 invoked by alias); 18 Mar 2018 03:50:52 -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: 23258 Received: (qmail 13845 invoked by uid 1010); 18 Mar 2018 03:50:52 -0000 X-Qmail-Scanner-Diagnostics: from mta01.eastlink.ca 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(24.224.136.30):SA:0(-2.6/5.0):. Processed in 1.296244 secs); 18 Mar 2018 03:50:52 -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=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: rayandrews@eastlink.ca X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; CHARSET=US-ASCII; format=flowed X-Authority-Analysis: v=2.3 cv=dfKuI0fe c=1 sm=1 tr=0 a=RnRVsdTsRxS/hkU0yKjOWA==:117 a=RnRVsdTsRxS/hkU0yKjOWA==:17 a=IkcTkHD0fZMA:10 a=Y4iXjpf3LC6X-4Ocz7gA:9 a=QEXdDO2ut3YA:10 X-EL-IP-NOAUTH: 24.207.101.9 Subject: Re: real time alias? To: zsh-users@zsh.org References: <98aa0638-97ed-dfe0-8dd2-39129d02c084__39937.2481661432$1521136270$gmane$org@eastlink.ca> <20180317224747.GA1927@chaz.gmail.com> From: Ray Andrews Message-id: <2f43ddf4-2394-ced4-0d21-ba592bf42a31@eastlink.ca> Date: Sat, 17 Mar 2018 20:20:45 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 In-reply-to: <20180317224747.GA1927@chaz.gmail.com> Content-language: en-CA On 17/03/18 03:47 PM, Stephane Chazelas wrote: > 2018-03-15 10:51:47 -0700, Ray Andrews: > > You can always use eval: > > $ f() { eval 'myalias 1'; echo done; } > $ alias myalias=echo; f > 1 > done > $ alias myalias=return; f > $ echo $? > 1 > That's exactly what I had in mind: Script: alias alias1="echo one" function test1 () { eval alias1 } alias alias1="echo two" test1 alias alias1="echo three" test1 alias alias1="echo four" test1 Output: two three four ... so, bearing in mind what Bart said about aliases being able to carry any sort of foul up of syntax, one must be careful since whatever is in the alias at parsing will be checked for sanity, but after that I'd expect one is on one's own.