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.

3
  • Is there a POSIX compatible way? Commented Jun 17, 2022 at 12:27
  • ITYM IFS=$'\n' read -a arr -d '' <<< "$var", since you need to have the -d separator distinct from the IFS separator. Though you'd probably be better off using readarray/mapfile there, just mapfile -t arr <<< "$var" would do. Commented Jun 17, 2022 at 13:42
  • @Matteo, <<< already isn't standard. Also note that it adds a trailing newline, so you might get an extra one at the end. Commented Jun 17, 2022 at 13:43