I use the following Bash shell script to list the ".txt" files recursively in the current directory:
#!/bin/bash for file in $( find . -type f -name "*.txt" ) do echo $file
However, some of the .txt files in the current directory have spaces in their names, for example. "my testing.txt". The listing is getting corrupted, for example. "my testing.txt" is listed as
my testing.txt
It seems that the for loop uses a space (space, \ n, etc.) to split the list of files, but in my case I want to use only "\ n" to split the list of files.
Is there any way to modify this script to achieve this. Any idea.
Thanks in advance.
source share