alias with parameters

前端 未结 2 2118
被撕碎了的回忆
被撕碎了的回忆 2021-02-07 06:13

If there is any possibility to use the parameters in zsh aliases? Something like this:

 alias ssh_nokia=\"ssh root@\"

Usag

2条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-07 06:47

    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 …).

提交回复
热议问题