在ZSH中创建一个单词别名很容易。
有没有一种方法可以在Zsh中使用两个单词别名,以便两个单词都被解析为同一个别名?我主要想用它来修正打字错误。
alias ll='ls -lah'
有没有一种方法可以在Zsh中使用两个单词别名,以便两个单词都被解析为同一个别名?我主要想用它来修正打字错误。
alias 'gits t'='git st'
试试这个:
alias func='gits t'
func() {
'gits t'='git st'
}
关于 Zsh 别名函数的更多信息,请参考以下链接:
与纯 Bash 相同:
$ cd
$ vim .zshrc
...
tg() {
if [ -z "$1" ]; then
echo "Use correct second argument: apply/destroy/plan/etc"
else
if [ "$1" = "0all" ]; then
terragrunt destroy -auto-approve && terragrunt apply -auto-approve
elif [ "$1" = "0apply" ]; then
terragrunt apply -auto-approve
elif [ "$1" = "0destroy" ]; then
terragrunt destroy -auto-approve
else
terragrunt "$@"
fi
fi
}
...
不要忘记重新阅读文件:
$ source .zshrc
$ tg 0apply