title: Single quote expansion within an array
body: <p>AFAICT, anything inside a single quotes shouldn't be expanded. Bash manual says:</p>
  
  <blockquote>
    <p>Enclosing characters in single quotes preserves the literal value of 
    each character within the quotes.  A single quote may not occur 
    between single quotes, even when preceded by a backslash.</p>
  </blockquote>
  
  <p>However, in an older bash version this doesn't appear to be true in Bash <code>3.00.15(1)-release</code>.</p>
  
  <p>For example, consider (this is a contrived example of a bigger script):</p>
  
  <pre><code>#!/bin/bash
  
  func() {
  local -a cmds=('echo subshell echo hi')
  
      for cmd in "${cmds[@]}"; do
          echo "cmd: $cmd"
      done
  }
  
  func
  </code></pre>
  
  <p>prints:</p>
  
  <pre><code>cmd: echo
  cmd: subshell
  cmd: echo
  cmd: hi
  </code></pre>
  
  <p>whereas I expected:</p>
  
  <pre><code>cmd: echo subshell echo hi
  </code></pre>
  
  <p>This is not an issue in newer bash versions. The above works as expected in Bash <code>3.2.25(1)-release</code> and <code>4.3.46(1)-release</code>.</p>
  
  <p>Is this a bug in older bash shells? How can work around it so that single quoting preserves values (as I expected above) in bash <code>3.00.15(1)-release</code>?</p>