title: Bash array: Unexpected Syntax error
body: <p>I am writing this simple bash script as follows.</p>
  
  <pre><code>#!/bin/bash
  
  array=( /home/abc/Downloads/something.bat /home/abc/Downloads/smb.conf )
  echo ${array[@]}
  </code></pre>
  
  <p>I expected it to print all the names of the files in the array. But I get this error instead:</p>
  
  <pre><code>test.sh: 3: Syntax error: "(" unexpected
  </code></pre>
  
  <p>If I change the declaration of array to </p>
  
  <pre><code>array = {/home/abc/Downloads/something.bat /home/abc/Downloads/smb.conf}
  </code></pre>
  
  <p>this error goes away but I still have new errors</p>
  
  <pre><code>test.sh: 3: array: not found
  test.sh: 4: Bad substitution
  </code></pre>
  
  <p>How can I resolve this issue? This is my first time in shell programming so I am unable to fix the issues myself.</p>
  
  <p>RESOLVED:</p>
  
  <p>I was executing it as sh test.sh but I forgot I had to execute it as <strong>bash test.sh</strong></p>