exec("echo 'hello world'") # exits from ruby, then runs the command
system('echo', 'hello world') # returns the status code
sh('echo', 'hello world') # returns the status code
`echo "hello world"` # returns stdout
%x[echo 'hello world'] # returns stdout
Created
June 8, 2016 17:03
-
-
Save razorcd/367302c8752d9ddc6aee0380459dd77c to your computer and use it in GitHub Desktop.
ways to run shell commands in Ruby
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment