Variable to create a list

Hi all,

I couldn't find an answer for this easy question, probably because the keywords I used in the search are too generic.

I just want to make a list of numbers using the value of a variable, like this:

NumFiles=$(ls | wc -l)
for i in {1..$NumFiles}; do
[...]

Say $NumFiles = 5. Bash reads that as the string "{1..5}", but it won't generate the sequence of numbers I want.
How can I do this?

Thanks

Try:

for (( i = 1; i <= $NumFiles; i ++ )); do
...
for i in $(seq 1 $NumFiles)

Thanks a lot!