Reputation: 3
I am new to ruby and trying to do some command line stuff.
Now I need to save the output of
exec 'cat /etc/system-release'
in a variable to scan it for a number.
Upvotes: 0
Views: 252
Reputation: 84114
If you want to grab the output you're better off using system
or backticks (or for longer running tasks, IO.popen
)
In this case, it would be a lot faster to do
File.read('/etc/system-release')
rather than creating extra processes just to do this.
Upvotes: 2