 <p>I think you're trying to construct an array consisting of the names of all zero-length files and directories in <code>$DIR</code>. If so, you can do it like this:</p> <pre><code>mapfile -t ZERO_LENGTH &lt; &lt;(find "$DIR" -maxdepth 1 -size 0) </code></pre> <p>(Add <code>-type f</code> to the find command if you're only interested in regular files.)</p> <p>This sort of solution is almost always better than trying to parse <code>ls</code> output.</p> <p>The use of process substitution (<code>&lt; &lt;(...)</code>) rather than piping (<code>... |</code>) is important, because it means that the shell variable will be set in the current shell, not in an ephimeral subshell.</p>