Writing a bash script, I got an error when trying to run it :
syntax error near unexpected token `(' declare -a
My array was declared was :
declare -a persons = ('person1' 'person2')
Even though my code looks correct and nice ;) , Unix don't accept it. I was removing the quotes.... but nothing worked.
And finally I find the solution: In fact we shouldn't put any space between = and (.
declare -a persons=('person1' 'person2')
syntax error near unexpected token `(' declare -a
My array was declared was :
declare -a persons = ('person1' 'person2')
Even though my code looks correct and nice ;) , Unix don't accept it. I was removing the quotes.... but nothing worked.
And finally I find the solution: In fact we shouldn't put any space between = and (.
declare -a persons=('person1' 'person2')