I am trying to assign an array of three values ββto a variable if it is not already assigned with a line
: ${SEAFILE_MYSQL_DB_NAMES:=(ccnet-db seafile-db seahub-db)}
Unfortunately, the echo ${SEAFILE_MYSQL_DB_NAMES[@]} results in (ccnet-db seafile-db seahub-db) , and ${SEAFILE_MYSQL_DB_NAMES[2]} does not print anything. The value seems to be interpreted as a string, not as an array. Is there a way to make my script assign an array this way?
This problem occurs in Debian Jessie with bash 4.3.30 (if that matters in the docker container). Interestingly, the same code runs on Ubuntu 16.04 with bash version 4.3.42, where it is treated as an array, as I would expect.
source share