title: Storing ls output in a variable and splitting it is not working
body: <pre><code>#!/usr/bin/bash
  
  dirs="$(ls /)"
  IFS=' ' read -a dir &lt;&lt;&lt;"$dirs"
  for item in "${dir[@]}"; do
      if [[ $item != "proc" ]]; then
          du -sh /$item
      fi
  done
  </code></pre>
  
  <p>I want to list the folders in /, and checked the size of them, <code>ls /</code> response <code>bin boot dev etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var</code>, but the result is only one item <code>0       /bin</code>, if I change to to</p>
  
  <pre><code>#!/usr/bin/bash
  
  dirs="bin boot dev etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var"
  IFS=' ' read -a dir &lt;&lt;&lt;"$dirs"
  for item in "${dir[@]}"; do
      if [[ $item != "proc" ]]; then
          du -sh /$item
      fi
  done
  </code></pre>
  
  <p>the result will be correct, how to make it work?</p>