Calling Bash commands from Ruby and returning output? -
the following code includes command , string:
files = `ls /tmp`
i /tmp
variable instead of static string, , ideally like:
dir = '/tmp' command = 'ls ' + dir files = `command`
what correct ruby syntax achieve this?
use string interpolation:
dir = '/tmp' files = `ls #{dir}`
Comments
Post a Comment