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*

4
  • That's POSIX word splitting (zsh doesn't do it). Can you fiddle with IFS without breaking anything? Otherwise, the code that can't be changed must be corrected to use double quotes. Commented May 9, 2017 at 21:20
  • Try printf -v MYOPT '%q' "With Space" Commented May 9, 2017 at 21:31
  • Cannot reproduce. The double quotes are stripped out of the variable assignment and do not appear in the output. Perhaps you have Unicode double quote characters in the original? Commented May 9, 2017 at 23:30
  • Also see Why does my shell script choke on whitespace or other special characters? for the Right Way to Do It. Commented May 9, 2017 at 23:55