From: Kevin Ballard Date: 2005-10-18T22:51:57+09:00 Subject: Re: inner string to path See above about the multi-argument form, but if you want to stick with single-argument, you can do something like foo = `ls \'#{str.gsub("'", "\\'")}\'` That keeps an internal single-quote from terminating the string. Alternately, you could do something lik foo = `ls #{str.gsub(/[" ']/, '\\\\\0') That escapes spaces and quotes. And if you have LANG (or LC_CTYPE) set to the right encoding (probably en_US.UTF-8) then the accented characters will work fine as well. Note: I needed 5 backslashes in that single-quoted string because of how gsub works. The string itself evaluates to \\\0, which gsub then turns into \ followed by the matched string. Not very intuitive, how gsub compresses backslashes, but I can understand why it does that.