Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: real time alias?
- X-seq: zsh-users 23243
- From: Jérémie Roquet <jroquet@xxxxxxxxxxxxx>
- To: Ray Andrews <rayandrews@xxxxxxxxxxx>
- Subject: Re: real time alias?
- Date: Thu, 15 Mar 2018 18:57:33 +0100
- Cc: Zsh Users <zsh-users@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-transfer-encoding; bh=dn6kvxUyFK3U7tF3v11IwdlxIRlwUG9pUNwnS0k/CFY=; b=ddzs+jHBjeO0w90ZxGverJWgQmZsNrxHF4x1CD+Sdo7xKdtVoobb5TOWdtawKTDq04 n543afuv/oXLPqNCdVIgpXbOeyk5ZUhpqcAgTW8ZeprU+n0LEM7JZAJapL7KBFMu/KfS ZJ0hW7O4AmxDexU+LZ1pZ6sER4fcWv+IvnhbI2m/FjpwR4PfH4kOxdvRbz2WzEPStPB1 N30L2Jjed1GBdCVLMYmOItRiRORW8TlidY+sWwVUDLT6P+sRvE53nQ00EAckzE2rriIW 8nZQ7GU3x9b5Q43yGTFhTzJoVTw4o4yp7gQv60XJE2OW4eJBFaIe+GR+2FIHxfTrzegN nEdg==
- In-reply-to: <98aa0638-97ed-dfe0-8dd2-39129d02c084@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>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <98aa0638-97ed-dfe0-8dd2-39129d02c084@eastlink.ca>
- Sender: arkanosis@xxxxxxxxx
2018-03-15 18:51 GMT+01:00 Ray Andrews <rayandrews@xxxxxxxxxxx>:
> 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 use a function instead of an alias:
With an alias:
$ alias foo="echo first"
$ bar() { foo }
$ bar
first
$ alias foo="echo second"
$ bar
first
With a function:
$ foo() { echo first }
$ bar() { foo }
$ bar
first
$ foo() { echo second }
$ bar
second
Best regards,
--
Jérémie
Messages sorted by:
Reverse Date,
Date,
Thread,
Author