В Ruby или в Rails: - мне нужно показать вывод кода, приведенного ниже, как показано в командной строке.
require 'net/ssh'
Net::SSH.start( hostname, username, :password => password ) do|ssh|
result = ssh.exec!('ls -ltr')
puts result
end
Дайте мне знать, как это возможно?
Команда (ls -ltr) является динамической ив настоящее время вывод:
total 257140 drwxrwxr-x 8 folderabc folderabc 4096 Set 4 2010 sources drwxrwxr-x 13 folderabc folderabc 4096 Set 4 2010 teste -rwxrwxr-x 1 folderabc folderabc 72 Set 7 2010 clean_memory -rw-rw-r-- 1 folderabc folderabc 263012352 Mar 17 2011 ngforms_production.sql -rw-rw-r-- 1 folderabc folderabc 21 Jun 23 2011 phps.php drwxrwxr-x 15 folderabc folderabc 4096 Jun 30 2011 ngforms -rw-rw-r-- 1 folderabc folderabc 751 Jul 1 2011 ngforms_word.sql -rw-rw-r-- 1 folderabc folderabc 31 Jul 5 2011 test.php drwxrwxr-x 5 folderabc folderabc 4096 Nov 4 10:52 dump drwxrwxrwx 2 folderabc folderabc 4096 Jan 13 00:00 mysqlbackup