I am a noob when it comes to the Shell
This block should work, but it doesn't
#!/bin/bash
# LOCAL CONFIGURATION SETTINGS - DB_CONFIG is a "fake" associative array
#----------------------------------------------------------------------------------
DB_CONFIG=(
"DB_NAME=>"
"DB_USER=>root"
"DB_PASSWORD=>root"
"DB_HOST=>127.0.0.1"
"DB_CHARSET=>utf8"
"DB_COLLATE=>"
);
for prop in ${DB_CONFIG[@]} ; do
key=${prop%%=>*}
value=${prop##*=>}
echo $key;
if[["$key" == "DB_HOST"]] then
db_host="$value"
if[["$key" == "DB_PASSWORD"]] then
db_password="$value"
done;
# now set the mysql_conn string with the vars above.
MYSQL_CON="/Applications/MAMP/Library/bin/mysql --host=$db_host -uroot -$db_password"
exit;
REPO='http://svn.wp-plugins.org/'
The problem is how to check the condition if $key == 'DB_HOST' I just can't figure out the syntax of the expression. I have look into how to do it, but on my mac ( running bash 3.2 ) if complains of syntax errors.