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*

2
  • 1
    There may actually some way to do that directly, but you could just replace the multi-character separator with a character which doesn't appear in the string: foo='a sep b sep c'; s=$'\1'; IFS=$s read -ra <<<"${foo//sep/$s}" array; printf "{%s}\n" "${array[@]}" Commented Jun 5, 2019 at 18:46
  • Will your array ever have more than two elements? Commented Jun 5, 2019 at 19:14