带参数的别名 [英] alias with parameters
本文介绍了带参数的别名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否有可能在zsh别名中使用参数?像这样:
If there is any possibility to use the parameters in zsh aliases? Something like this:
alias ssh_nokia="ssh root@<ip_parameter>"
用法:
ssh_nokia 192.168.1.2
推荐答案
在您的特殊情况下,请编辑〜/.ssh/config(请参见下面的Dave回答),或使用:
In your particular case edit ~/.ssh/config (See Dave's answer below), or use:
alias ssh_nokia='ssh -l root'
通常
ssh_nokia() {
ssh root@"$@"
}
等同于别名(将产生ssh root@1stparam 2ndparam 3rdparam …
).
is equivalent to alias (will produce ssh root@1stparam 2ndparam 3rdparam …
).
这篇关于带参数的别名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文