Eu usaria uma matriz:
# get the files
files=(*.py)
# list the files
printf "%s\n" "${files[@]}"
# count the files
n=${#files[@]}
# iterate over the files
for file in "${files[@]}"; do
someCommand "$file"
done
# or, if you want the index for some reason
for ((i=0; i < n; i++)); do
echo "$i: ${files[i]}"
done
tutorial de matrizes do bash aqui