title: When change $IFS in bash on Mac OS X
body: <p>I met a problem when I change the value of $IFS in bash on Mac OS X. For example, I have a main directory <code>/XXX/XXX/XXX</code>, and two sub-directories <code>subdir1</code> and <code>subdir2</code>. If I run the shell script</p>
  
  <pre><code>maindir=/XXX/XXX/XXX;
  subdirs=$(find $maindir -type d -maxdepth 1);
  echo $subdirs
  </code></pre>
  
  <p>Normally I get the results like this</p>
  
  <pre><code>/XXX/XXX/XXX/subdir1 /XXX/XXX/XXX/subdir2
  </code></pre>
  
  <p>These two subdirectories are separated by <code>Blankspace</code>. The problem is, when I change once the <code>$IFS</code> value like this:</p>
  
  <pre><code>OLDIFS=$IFS; 
  IFS=$'\n';
  IFS=OLDIFS;
  </code></pre>
  
  <p>After that, if we check again the value of <code>$subdirs</code></p>
  
  <pre><code>echo $subdirs
  </code></pre>
  
  <p>The results become</p>
  
  <pre><code>/XXX/XXX/XXX/subdir1
  /XXX/XXX/XXX/subdir2
  </code></pre>
  
  <p>It seems that bash automatically changes <code>Blankspace</code>  to <code>\n</code>. This really bothers me. Is there a solution to change <code>\n</code> back to <code>Blankspace</code>? My system is Mac OS X version 10.7.5.</p>