I'm trying to grab a list of file names from a directory, then process those files 5 at a time. In the link below. Instead of using files I'm using the files array which contains 15 strings starting with AAA .
So I'm trying to assign $fileset 5 of the strings at a time to pass to a command. So $fileset looks like this the first pass:
AAA BBB CCC DDD EEE
Then the second iteration:
FFF GGG HHH III JJJ
files=( AAA BBB CCC DDD EEE FFF GGG HHH III JJJ KKK LLL MMM NNN OOO )
echo "Total files in array : ${#files
[*]}"
total=${#files
[*]}
for (( i = 0 ; i < $total ; i++ )) do
fileset=""
for (( j = $i ; j < 5 ; j++ )) do
fileset=$fileset${files[$j]}
done
echo $fileset
fileset=""
done