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.

5
  • printf "%s\n" "${variable[@]}" Commented Jun 29, 2018 at 0:33
  • @jasonwryan Thanks for replying. But for some reason this command is just replacing the last character from the line, it's not replacing the spaces in the middle... Commented Jun 29, 2018 at 0:43
  • 1
    How is "$variable" created? Commented Jun 29, 2018 at 0:47
  • @jasonwryan The steeldriver answer solved the problem. I was actually testing on the terminal declaring it with variable="\"path1\" \"path2\" \"path3\""... But now I see that it needs to be declared as an array to make it work with the printf. Commented Jun 29, 2018 at 1:21
  • I would handle this as CSV data and use a CSV parser with space as the field separator. Commented Jun 29, 2018 at 14:28