I am trying to play with bash and arrays. But executing a sample script, I got an unexpected syntax error message:
example.sh: 3: example.sh: Syntax error: "(" unexpected. And this is the script
#!/bin/bash array=( one two three )
If I run the script with ./example.sh it works and no errors are displayed. But if I run
sh example.sh I get the error message.
I thought that these two commands are the same:
- sh example.sh
so ... what is the difference between the two?