I'm trying to loop through an array in Bash when using rclone. I have set up an array of paths, and I'm looping through them, but I also want to echo the path name in the console window. When I run my code, because the paths have spaces in them, the echo command shows each part of the path, instead of the whole path. Here is my code;
folder[0]="a path here"
folder[1]="another path here"
folder[2]="another path here"
folder[3]="another path here"
for item in ${folder[*]}; do
echo "syncing $item ..."
rclone copy ~/"Documents/$item" Box:"$item" -u -vv --syslog
done
What I see is
syncing 'a' ...
syncing 'path' ...
syncing 'here' ...
syncing 'another' ...
syncing 'path' ...
syncing 'here' ...
What I want to see is the full path string. Not sure what I'm doing wrong here, I guess it's the referencing in the folder[*]
causing me the problem.