I am getting an error when using sh, but not bash. Any idea why?
$ sh test.sh
test.sh: 5: test.sh: Syntax error: "(" unexpected (expecting "fi")
#!/bin/bash
if [ 1 -eq 1 ]
then
declare -a methods=(Method1 Method2 Method3)
for i in "${methods[@]}"
do
echo $i
done
else
echo not found
fi