Multiple commands on remote machine using shell script

后端 未结 3 521
遇见更好的自我
遇见更好的自我 2020-12-01 12:30

I have a Java program Desktop/testfolder/xyz.jar on a remote machine. It has a configuration file on the same folder. When I SSH into the machine, I do:

3条回答
  •  有刺的猬
    2020-12-01 12:33

    If you want to split your commands over multiple lines for the sake of readability, you could also pass the list of commands to the bash command as follows:

    ssh user@remote.host bash -c "'
      cd Desktop/testfolder
      java -cp xyz.jar Main
    '"
    

提交回复
热议问题