How to execute a remote command over ssh with arguments?

前端 未结 4 714
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-07 20:09

In my .bashrc I define a function which I can use on the command line later:

function mycommand() {
    ssh user@123.456.789.0 cd testdir;./test         


        
4条回答
  •  孤街浪徒
    2020-12-07 20:48

    Reviving an old thread, but this pretty clean approach was not listed.

    function mycommand() {
        ssh user@123.456.789.0 <<+
        cd testdir;./test.sh "$1"
    +
    }
    

提交回复
热议问题