I want to store a list of files in a variable
FILELIST="$( find . -name *.ext )"
and later in the script I want to print the list to the user and count the number of files in the list.
FILECOUNT="$( echo $FILELIST | wc -l )"
That doesn't work tho because the list is separated by white spaces instead of new lines, so the print out is ugly and line count is always equal to 1. How can I work around this?
Thanks in advance!