I want to make a list of all files in a directory and it's subdirectories with a bash script but my array is always empty. I run my script with bash version 4 in Ubuntu 18.04.1. Here is my code:
#!/bin/bash
FILES=()
find ./* -maxdepth 10 -type f | while read file;
do
echo $file
FILES+=("$file")
done
echo "${FILES[@]}"
Thank you.