I have a directory myDir of many .html files. I am trying to create an array of all the files in the directory so I might be able to index the array and be ab
Your solution will work for generating the array. Instead of using a while loop, use a for loop:
#!/bin/bash
files=($( ls * )) #Add () to convert output to array
counter=0
for i in $files ; do
echo Next: $i
let counter=$counter+1
echo $counter
done