I'm new to bash scripting. I'm trying to use variables for counters in a nested for loop, like this:
dir_count=$(find dump_${d}/* -maxdepth 0 -type d | wc -l)
count_by=11
for ((i=0;i<=$dir_count;i+=$count_by))
do
((start=$i+1))
((end=$count_by+$i))
echo $start $end
for dir in {$start..$end}
echo $dir
done
done
Output is this (I'm getting errors):
1 11
./loopy.sh: line 23: [: {1..11}: integer expression expected
12 22
./loopy.sh: line 23: [: {12..22}: integer expression expected
23 33
./loopy.sh: line 23: [: {23..33}: integer expression expected
1, 11, 12, 22, 23, 33 all look like integers to me! Is it possible to type variables? I thought it wasn't.
Thanks!