Ruby/Development/Shell

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

Версия от 17:10, 26 мая 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