0

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.

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks a lot for formatting and the hints. I will use File.read now :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.