When I try to execute the following
#!/bin/sh
folders=("/usr/include")
for i in ${folders[@]}; do
echo ${i}
done
exit 0
I get test.sh: 3: test.sh: Syntax error: "(" unexpected
. I also tried using #!/bin/bash
but it didn't work neither. I tried this on Debian Jessie in a script and it produced the above mentioned error. The same script runs fine on Ubuntu 14.04.
Additionally I tried
# foo=(/usr/include); echo $foo
/usr/include
which worked well.
I also checked it for non-printable characters with cat -e test.sh
#!/bin/sh$
$
folders=("/usr/include")$
for i in ${folders[@]}; do$
echo ${i}$
done$
exit 0$
Edit
I executed the script as sh ./test.sh