1

I need a script for build an array with the names of files in a folder. For example in the folder1 I have 4 files, so the array must have in position 0,1,2,3 the names of these 4 files. I've found this script:

declare -a FILELIST
for f in *; do
     FILELIST[${#FILELIST[@]}+1]=$(echo "$f");
done

echo ${FILELIST[@]}                     

but I'm new to bash and I don't understand the meaning behind these commands.

Inian
  • 80,270
  • 14
  • 142
  • 161
mark Franz
  • 85
  • 1
  • 6

0 Answers0