From: 7stud -- Date: 2007-10-14T09:58:16+09:00 Subject: Re: backquotes question Zouplaz wrote: > Hello, I would like to know why > cmd = "/bin/df -H /dev/#{partition}" > used = `#{cmd}` > > works fine but this fails > used = `"/bin/df -H /dev/#{partition}"` > > with an OS error. > Well, first of all they aren't equivalent. For instance, writing this: str = "hello" puts "Hi, #{str} world." isn't equivalent to writing: puts "Hi, "hello" world." I don't know enough about Unix to know the reason for the system error, but this works: flags = "-l" puts `ls #{flags}` But, this does not: puts `"ls -l"` The internal quotes messes things up. > > BTW, is there an aliase to the backquote ? I mean a kernel method doing > the same - Just for the syntax, backquotes are not very sexy. > puts %x{ls -l} -- Posted via http://www.ruby-forum.com/.