I frequently write for-loops in bash with the well-known syntax:
for i in {1..10} [...]
Now, I\'m trying to write one where the top is def
You can use for loop like this to iterate with a variable $TOP:
$TOP
for ((i=1; i<=$TOP; i++)) do echo $i # rest of your code done