title: BASH: Returning an array output from a function
body: <p>I am currently working on bash script below which reads from an xml document and return the values city on holiday.</p>
  
  <pre><code>xmlconfig="/home/scripts/sample.xml"
  dt=$(date +'%Y%m%d')
  
  cty=$(get-holiday-country "$dt" "$xmlconfig")
  echo "This are the cities:"
  echo "$cty"
  
  get-holiday-country()
  {
          declare -a arr
          for q in `echo 'cat /holiday[@date="$1"]/country/@value' | xmllint --shell "$2" | awk -F\" '/=/ { print $2; }'`
          do arr+=("$q")
          done
  }
  </code></pre>
  
  <p>However, I am getting a null value on the function I created and when running the for loop alone it is working.</p>
  
  <pre><code>for q in `echo 'cat /holiday[@date="$1"]/country/@value' | xmllint --shell "$2" | awk -F\" '/=/ { print $2; }'`; do echo "$q"; done
  </code></pre>
  
  <p>Can you help me find out what I did wrong?</p>