< BACK

Bash tips, tricks and code snippets

Read a string into an array in Bash

According to this posting, given a string delimited with spaces, e.g. line="0.1 1 two three"

arr=($line)

or

read -a arr <<< $line

WITHOUT using quotes will work.