I’m using ruby 1.8.4. I’m trying to use the gsub function to escape
spaces in a linux path that is stored in a variable.
When I attempt the following, t = “a B”; t.gsub(/ /, "\ "), I receive
the following output:
irb(main):001:0> t = “a B”; t.gsub(/ /, "\ ")
=> “a\ B”
I’d like to get “a\ B” (without quotes, of course). Can someone point
me in the proper direction? Note: I’ve tried many different variations
with no luck.