question about net-ssh

E

Edwin Chen

Hi guys,

I am learning ssh module. I have a question about the channel.
Please kindly give me some tips if you are familiar with this module.
Thank you in advice!! :)

Code slice:
---------------------------
Net::SSH.start(host,user,:password=>pass) do |ssh|
ssh.open_channel do |channel|
channel.on_data do |ch, data|
if data =~ /Done/
ch.exec("command2") --here is the question
end
end
channel.exec("command1") --cmd1 will return different result
end
end


Can I invoke exec(channel) twice in one channel?
If not, what is the use for "ch" variable here.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top