Usually when writing for loops in bash script, I will write like this:
FILE[1]=/tempA/aaa
FILE[2]=tempB/bbb
for FILES in `ls -1 ${FILE[@]}`
do
echo $FILES
done
this will display the FILE depending how many I initialize the FILE because it is in array. I need to create a bash script to copy files from a directory to another directory.
assuming like this:
SOURCE[1]=/tempA/source/aaa
SOURCE[2]=/tempB/source/bbb
DEST[1]=/tempA/dest/
DEST[2]=/tempB/dest/
I need to copy from source[1] to dest[1] also from source[2] to dest[2]. So my question how I need to write the FOR loops? or maybe there are another way to do other than for loops?
Thanks!