How to execute a remote command over ssh with arguments?

前端 未结 4 701
佛祖请我去吃肉
佛祖请我去吃肉 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:25

    I'm using the following to execute commands on the remote from my local computer:

    ssh -i ~/.ssh/$GIT_PRIVKEY user@$IP "bash -s" < localpath/script.sh $arg1 $arg2
    

提交回复
热议问题