How can i execute 2 or more commands in the same ssh session?

前端 未结 7 1414
南方客
南方客 2021-01-06 01:14

I have the following script:

#!/usr/bin/env ruby
require \'rubygems\'
require \'net/ssh\'

Net::SSH.start(\'host1\', \'root\', :password => \"mypassword1\         


        
7条回答
  •  暖寄归人
    2021-01-06 01:35

    see if there's something analogous to the file(utils?) cd block syntax, otherwise just run the command in the same subshell, e.g. ssh.exec "cd /var/example/engines/; pwd" ?

提交回复
热议问题