Use single-quotes whenever you need to pass user input data to a shell script or command, e.g:

2.0.0p247 :001 > string = 'testing'
 => "testing" 
2.0.0p247 :002 > %x[echo #{string}]
 => "testing\n" 
2.0.0p247 :003 > string = 'testing ; uname -r'
 => "testing ; uname -r" 
2.0.0p247 :004 > %x[echo #{string}]
 => "testing\n2.6.32-279.2.1.el6.x86_64\n" 
2.0.0p247 :005 > %x[echo '#{string}']
 => "testing ; uname -r\n"