Ruby 改变 SSH 上的当前目录

2015-09-03 0 823
Ruby 改变 SSH 上的当前目录
require 'rubygems'
require 'net/ssh'


Net::SSH.start('example.com', :username=>'yourName',
               :password=>'mypass') do |session|
  shell = session.shell.sync
  puts "#{shell.pwd.stdout}"
  shell.cd 'test_dir'
  puts "#{shell.pwd.stdout}"
  puts 'Directory contents:'
  puts shell.ls("-l").stdout
  shell.exit
end

遇见资源网 ruby Ruby 改变 SSH 上的当前目录 http://www.ox520.com/16444.html

上一篇: Combination Finder
下一篇: Ruby策略模式2
常见问题

相关文章

发表评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务