Use shell command wrapper through shell library : Shell « Development « Ruby






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

 








Related examples in the same category