title: Splitting a list in bash
body: <p>I have this script:</p>
  
  <pre><code>#!/bin/bash
  
  list="a b c d"
  
  for item in ${list[@]}; do
    echo "${item}"
  done
  </code></pre>
  
  <p>When I run it this is the output:</p>
  
  <pre><code>a
  b
  c
  d
  </code></pre>
  
  <p>This is <strong>exactly</strong> what I want. However, <code>shellcheck</code> hates this and throws an error:</p>
  
  <pre><code>for item in ${list[@]}; do
              ^-- SC2068: Double quote array expansions to avoid re-splitting elements.
  </code></pre>
  
  <p>But, when I double quote the variable the output of the script changes to this:</p>
  
  <pre><code>a b c d
  </code></pre>
  
  <p>Which is <em>not</em> what I want.</p>
  
  <p>Is shellcheck right and should I modify the way I try to extract the items from the variable, but how? Or should I just tell <code>shellcheck</code> to ignore this?</p>