Search This Blog

BASH script: split string to array

str="a,b,c,d"
IFS=',' read -r -a array <<< "$str"

for e in "${array[@]}"
do
    echo $e
done



see also

No comments:

Post a Comment