I'm running some code on the command line that should execute some simple code inside a double nested loop, along with some printf
-ing to track my progress:
for i in {1..180}; do for j in {1..200}; do
printf "$i-$j\r";
if [[ ! -f $dir/$i/$j/file0 ]] || [[ ! -f $dir/$i/$j/file1 ]]; then
echo $j >> $i.missing;
fi; done; done
To my great surprise, I see the inner loop index $j
is reaching well over 200 - I've seen it go as high as 960. This may explain why this code is running so painfully slowly. I'm not really sure what mistake I've made here - does nesting loops in bash not work the way I think it does?