Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: real time alias?
On 15/03/18 02:44 PM, Marc Chantreux wrote:
my advice is: see aliases as macro: don't use it as long as you can
achieve things with functions. one of the reasons is aliases can be used
after a variable expansion and so you can get some surprising behaviors.
Yeah, I know what to expect, I'm mostly just curious about possibilities.
$ alias test2="echo this is the original alias test2"
$ function test3 () { echo this is function test3 }
$ function test1 ()
{
test2
test3
}
$ alias test2="echo changed alias test2"
$ function test3 () { echo "test3 is now changed" }
$ test1
this is the original alias test2
test3 is now changed
... to be honest I can't even think of a reason to want anything more
than what we have, but I was curious. One might imagine:
$ function test1 ()
{
test2 # unchanged since last sourcing of this function.
setopt GRAB_ALIASES_AGAIN test2
test2 # Up-to-date.
test3
}
Nevermind.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author