说到壳牌,我是菜鸟
这个块应该工作,但它没有
#!/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/'
$key == 'DB_HOST'
问题是如果我无法弄清楚表达式的语法,如何检查条件。我已经研究了如何做到这一点,但是在我的 mac(运行 bash 3.2)上,如果抱怨语法错误。