From: Albert Schlef Date: 2010-04-09T20:46:34+09:00 Subject: Re: How to capture output of linux command Damjan Rems wrote: > > You can run linux command: > > a = `ls /home` > > and receive output in variable a. > > But I would like /home to be variable. So I would invoke command like > this: > > a = `"ls #{dir}"` As Ryan said, you need to remove the double quotes. You're asking the shell to execute the "ls whatever" command. There's no such command. BTW, you actually want double quotes there, but put them around the parameter: a = `ls "#{dir}"` The purpose of the double quotes here is to protect against the case where the 'dir' variable contain spaces (which are meaningful to the shell --they separate tokens). -- Posted via http://www.ruby-forum.com/.