Ruby
Execute external command which does not need standard input/output
in Ruby
Execute external command which does not need standard input/output. Ruby has several method to execute external command.
This sample shows three patterns to execute touch command on Linux to create a file.
command.rb
#!/usr/bin/ruby `touch panda.txt` system("touch giant_panda.txt") exec("touch cute_panda.txt")
Result
$ ls command.rb $ ruby command.rb $ ls command.rb cute_panda.txt giant_panda.txt panda.txt