I use the following Bash Shell script to list the ".txt" files recursively under the current directory :
#!/bin/bash
for file in $( find . -type f -name "*.txt" )
do
echo $file
# Do something else.
done
However, some of the ".txt" files under the current directory have spaces in their names, e.g. "my testing.txt". The listing becomes corrupted, e.g. "my testing.txt" is listed as
my
testing.txt
It seems that the "for" loop uses "white space" (space, \n etc) to separate the file list but in my case I want to use only "\n" to separate the file list.
Is there any way I could modify this script to achieve this purpose. Any idea.
Thanks in advance.