I want to get the expansion of an alias.
For example, if I have:
alias g=hub
alias cdh='cd $HOME'
I want to have:
expand_alias g
== hub
expand_alias cdh
== cd $HOME
The tricky thing is that the two shells have different output: bash:
$ alias g cdh
alias g='git'
alias cdh='cd $HOME'
zsh:
% alias g cdh
g=hub
cdh='cd $HOME'
Note no alias
prefix and no quotes around hub
.
zsh
output is the standard one.bash
will give you that one as well when in POSIX mode.cd
without arguments already brings you to$HOME