title: Shell Script: correct way to declare an empty array
body: <p>I'm trying to declare an empty array in Shell Script but I'm experiencing an error.</p>
  
  <pre><code>#!/bin/bash
  
  list=$@
  
  newlist=()
  
  for l in $list; do
  
          newlist+=($l)
  
  done
  
  echo "new"
  echo $newlist
  </code></pre>
  
  <p>When I execute it, I get <code>test.sh: 5: test.sh: Syntax error: "(" unexpected</code></p>