x=$(find . -name \"*.txt\")
echo $x
if I run the above piece of code in Bash shell, what I get is a string containing several file names separated
I like to use find which is first assigned to variable and IFS switched to new line as follow:
FilesFound=$(find . -name "*.txt")
IFSbkp="$IFS"
IFS=$'\n'
counter=1;
for file in $FilesFound; do
echo "${counter}: ${file}"
let counter++;
done
IFS="$IFSbkp"
Just in case you would like to repeat more actions on the same set of DATA and find is very slow on your server (I/0 high utilization)