0

I'm trying to get a value from a system call in Ruby:

distro = system('lsb_release -is')
distver = system('lsb_release -rs | cut  -c1-2')

I thought the return from the lsb_release comes into the variables. But if I'm made a puts distro or puts distver I'm just getting true.

Is there any way to get the value from them?

Yu Hao
  • 119,891
  • 44
  • 235
  • 294
Sascha Manns
  • 2,331
  • 2
  • 14
  • 21
  • It has already been asked before lots of times. Here's one answer: http://stackoverflow.com/questions/690151/getting-output-of-system-calls-in-ruby – Yaro Holodiuk May 12 '15 at 18:40

1 Answers1

1

You can go with

d = `date`
e = IO.popen("date").read

Take some time also with IO.popen, IO.popen2, IO.popen3.

Sebastian
  • 2,618
  • 3
  • 25
  • 32