Hi,
I want to store a list of files in a variable
Code:
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.
Code:
FILECOUNT="$( echo $FILELIST | wc -l )"
echo $FILELIST
echo $FILECOUNT
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!