Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: real time alias?
- X-seq: zsh-users 23256
- From: Stephane Chazelas <stephane.chazelas@xxxxxxxxx>
- To: Ray Andrews <rayandrews@xxxxxxxxxxx>
- Subject: Re: real time alias?
- Date: Sat, 17 Mar 2018 22:47:47 +0000
- Cc: Zsh Users <zsh-users@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=5yY3yRrz+vyB1NlXflebexpSkdys4638JmXmUJR9XUg=; b=NwqsH1zxtx89hGD2dhIeB2noO+8qddwDvlPPaOYQs/3C6NfrSI+om21Hy1Fm91clc+ sfmJ17yxoNXrX3oQdWVO+ug/Mvct3knpiHxT4l6GU4juRn/TYRVc5yTwXPQfTVvmIOpb 684UqEoXt7tNv9RwMwT3ieyixOfd9cO+Xp7XoMFhK6cefYb16VU1EjhQG5raAjoV6iOB 5Hg2JlhP7bCXzFwNS9S7aLBmZQoOX7MhnUAEDCz1bQuWTDIDuCMIjOAR46p33X8720T5 LETiUOTEu14F12M8a3NpLkt5iDmXPU0wNwfBOpdZs4QHOMPZ70z136LVr6GG7ZZexUYd DrzA==
- In-reply-to: <98aa0638-97ed-dfe0-8dd2-39129d02c084__39937.2481661432$1521136270$gmane$org@eastlink.ca>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- List-unsubscribe: <mailto:zsh-users-unsubscribe@zsh.org>
- Mail-followup-to: Ray Andrews <rayandrews@xxxxxxxxxxx>, Zsh Users <zsh-users@xxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <98aa0638-97ed-dfe0-8dd2-39129d02c084__39937.2481661432$1521136270$gmane$org@eastlink.ca>
2018-03-15 10:51:47 -0700, Ray Andrews:
> If a function calls an alias, if the alias changes, the function must be
> resourced, yes? That makes nothing but sense sincethe alias is what it is
> at sourcing. An executed script uses the alias in 'real time'. But, is
> there a way to make a function also use the real time value of an alias?
[...]
You can always use eval:
$ f() { eval 'myalias 1'; echo done; }
$ alias myalias=echo; f
1
done
$ alias myalias=return; f
$ echo $?
1
--
Stephane
Messages sorted by:
Reverse Date,
Date,
Thread,
Author