Ho una stringascript Bash per convertire una stringa con spazio delimitato gettoni per un array
echo $STRING
che dà
first second third fourth fifth
fondamentalmente un elenco separato spazi.
Come faccio a prendere quella stringa e renderlo una matrice in modo che
array[0] = first
array[1] = second
ecc ..
ho cercato
IFS=' ' read -a list <<< $STRING
ma poi quando faccio un
echo ${list[@]}
stampa solo o ut "prima" e nient'altro
Vedi qui: http://stackoverflow.com/questions/918886/how-do-i-split-a-string-on -a-delimiter-in-bash – ceving