From: Albert Schlef Date: 2010-04-12T09:16:29+09:00 Subject: Re: How to capture output of linux command Schneider wrote: > On Apr 9, 8:46�am, Albert Schlef wrote: >> >> 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 viahttp://www.ruby-forum.com/. > > Keep in mind that `ls #{dir}` (without the quotes) is also DANGEROUS. > What if you (or someone) set dir = "~; rm -rf ~"? BAD. > > So, using quotes is also safer. No, using quotes isn't safer: dir = '123" ; rm -rf ~ ; echo "' `ls "#{dir}"` Results it doing ls "123" ; rm -rf ~ ; echo "" -- Posted via http://www.ruby-forum.com/.