Ruby/Development/Shell

Материал из Wiki.crossplatform.ru

(Различия между версиями)
Перейти к: навигация, поиск
м (1 версия: Импорт выборки материалов по Ruby)
 

Текущая версия на 17:55, 13 сентября 2010

Use shell command wrapper through shell library

require "shell"
sh1 = Shell.new             # Work in the current directory
sh2 = Shell.cd("/tmp/hal")  # Work in /tmp/hal
sh = Shell.new
sh.cat("/etc/motd") > STDOUT
(sh.echo "This is a test") > "myfile.txt"
(sh.cat "file1" "file2") | (tee "file3") > STDOUT