I would like to execute an OS command from my ruby script but I want to add an argument from a ruby variable.
I know that’s possible by using keyword system like that :
#!/usr/bin/env ruby directory = '/home/paulgreg/' system 'ls ' + directory
but is that possible by using the ‘backquotes or backticks syntax’ ? (I mean by using that syntax : ls)
No, that will just concatenate the output from
lsand the contents ofdirectory.But you can do this: