Ruby/Development/Shell

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

Перейти к: навигация, поиск

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