Hello I'm testing my self by using a tutorial on writing linux shell scripts ran into this issue usinng shell arrays. the syntax is being written using vi
name[0]=chuck
name[1]=samson
echo "hello, ${name[0]}"
echo "hello, ${name[1]}"
and saved file using :wq. I tried to run the file using sh svar.sh but got
name[0]=chuck is not found
name[1]=samson is not found
However when using coding ground GNU Bash v4.4 the scripts run correctly Why it doesn't work under this on this OS?
shdoesn't support arrays. Try running withbash.svar.sh. – Kulfy Jul 28 '20 at 16:40shpoints to/bin/dashnot as in the rest of the world to/bin/bash. This was a fun little gotcha introduced by Ubuntu devs years ago which, considering the massive installed base ofbashscripts amounted to a prank. – Stephen Boston Jul 28 '20 at 16:58shis alsodashon Debian. – Eliah Kagan Jul 28 '20 at 17:05