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

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -