# Question about net-ssh

**URL:** <https://www.ruby-forum.com/t/question-about-net-ssh/197642>\
**Category:** Ruby\
**Created:** [October 18, 2010, 8:35am UTC](https://www.ruby-forum.com/t/question-about-net-ssh/197642 "2010-10-18T08:35:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![okkezSS](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/85f322/32.png) [@okkezSS](https://www.ruby-forum.com/u/okkezSS)\
**Post date:** [October 18, 2010, 8:35am UTC](https://www.ruby-forum.com/t/question-about-net-ssh/197642/1 "2010-10-18T08:35:45Z")

</div>

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.
