You can use the backtick operator to delimit a command – it will return the result of the command. For example:
output = `ls /usr/`
=> "X11\nX11R6\nadic\nbin\nlib\n"
puts output
X11
X11R6
adic
bin
lib
solved How to use single quotes inside single quots to run bash script from ruby controller