title: How to copy an array in Bash?
body: <p>I have an array of applications, initialized like this:</p>
  
  <pre><code>depends=$(cat ~/Depends.txt)
  </code></pre>
  
  <p>When I try to parse the list and copy it to a new array using,</p>
  
  <pre><code>for i in "${depends[@]}"; do
     if [ $i #isn't installed ]; then
        newDepends+=("$i")
     fi
  done
  </code></pre>
  
  <p>What happens is that only the first element of depends winds up on newDepends.</p>
  
  <pre><code>for i in "${newDepends[@]}"; do
     echo $i
  done
  </code></pre>
  
  <p>^^ This would output just one thing. So I'm trying to figure out why my for loop is is only moving the first element. The whole list is originally on depends, so it's not that, but I'm all out of ideas.</p>