So I have my CSV file which looks like that:
repo_name1,path1,branch1 branch2
I read it with following code:
INPUT=repos.csv
OLDIFS=$IFS
IFS=','
[ ! -f $INPUT ] && { echo "$INPUT file not found"; exit 99; }
while read repo_name local_path branches
do
    printf "\n"
    echo "Repository name: $repo_name"
    echo "Local path: $local_path"
    cd $local_path
    for branch in $branches
    do
        echo branch
        printf "\n"
    done
done < $INPUT
IFS=$OLDIFS
And I want to split branch1 and branch2 to an array in bash script.
I tried everything that I found on stackoverflow
Loop through an array of strings in Bash?,
Split string into an array in Bash,
Reading a delimited string into an array in Bash
, but nothing is working correctly and what I'm getting is array containing 1 element -> branch1 branch2
Any ideas what I'm doing wrong?
 
    