split string into array shell script code example
Example 1: split string and create array bash
my_array=($(echo $string | tr "," "\n"))
Example 2: split string and create array bash
IFS=', ' read -r -a array <<< "$string"
my_array=($(echo $string | tr "," "\n"))
IFS=', ' read -r -a array <<< "$string"