Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

7
  • Thanks but as I mentioned in the title: I want to avoid escaping backslashes. Commented Mar 28, 2013 at 19:00
  • oops, I'll edit ^^ Commented Mar 28, 2013 at 19:03
  • Thanks! But read -r var seems to wait for input from STDIN. What if I am passing it as an argument? (e.g. foo \\here\is\some\path) Commented Mar 28, 2013 at 19:31
  • the shell IS interpreting backslashes. That's why you should probably move the argument passing to a read, see my "foo" example. Commented Mar 28, 2013 at 19:33
  • 1
    iow: you want a "non-standard" handling of strings by the shell : you could more easily (and more extensively) have your program be compliant to what you want, instead of trying to have the shell-invoking-that-program to behave like you want. So: pass the args (the ones containing "\" that you don't want to escape) once the program is started, via "read -r", and not on its invoking shell command-line. Commented Mar 29, 2013 at 10:00