How to use alias inside another alias in ZSH?
By Daniel Rodriguez •
Let's say I have the following alias definition in my ZSH config file:
alias myalias="cd /"how can I use myalias inside another alias? ie:
alias myaliasone="myalias && cd /usr"I have tried (with a real alias this one is a fake just for example purposes) but nothing happens and I am not able to see any errors as per debug or fix something, any ideas? If this is the right way to use alias inside another alias, do you know how I can debug this so I can find the root problem or what is happening?
11 Answer
There are two ways to do it:
Use a function instead of an alias
myalias() { cd /
}
alias myaliasone="myalias && cd /usr"Use the $aliases table
zmodload -F zsh/parameter p:aliases
alias myalias="cd /"
alias myaliasone="$aliases[myalias] && cd /usr" 2 More in general
"Zoraya ter Beek, age 29, just died by assisted suicide in the Netherlands. She was physically healthy, but psychologically depressed. It's an abomination that an entire society would actively facilitate, even encourage, someone ending their own life because they had no hope. Th…"