title: Bash Shell list files using "for" loop
body: <p>I use the following Bash Shell script to list the ".txt" files recursively under the current directory :</p>
  
  <pre><code>#!/bin/bash
  for file in $( find . -type f -name "*.txt" )
  do
    echo $file
    # Do something else.
  done
  </code></pre>
  
  <p>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</p>
  
  <pre><code>my
  testing.txt
  </code></pre>
  
  <p>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.</p>
  
  <p>Is there any way I could modify this script to achieve this purpose. Any idea.</p>
  
  <p>Thanks in advance.</p>