alias with parameters

倖福魔咒の 提交于 2019-12-03 05:52:13
Michael Krelin - hacker

In your particular case edit ~/.ssh/config (See Dave's answer below), or use:

alias ssh_nokia='ssh -l root'

Generally

ssh_nokia() {
    ssh root@"$@"
}

is equivalent to alias (will produce ssh root@1stparam 2ndparam 3rdparam …).

I would use up ~/.ssh/config to create an alias for a particular connection, like so:

Host=anyoldname
Hostname=[hostname or ip address]
User=root

Then you can:

$ ssh anyoldname

More info:

$ man ssh_config
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!