-1
我需要一些我有這樣的代碼SHELL:MySQL的命令返回NULL
ignore_tbl=("mg_de_reifen_import_temp" "mg_de_reifen_import" "mg_de_reifen_import_last")
until mysqladmin -u$dbUser -p$dbPass ping; do echo "Waiting for mysqld"; sleep 10; done
mysql -u$dbUser -p$dbPass -e "create database if not exists $dbName"
IGNORED_TABLES_STRING=''
for TABLE in "${ignore_tbl[@]}"
do
IGNORED_TABLES_STRING+="table_schema = 'exclude_test' AND table_name LIKE '${TABLE}' AND "
done
TEST="${IGNORED_TABLES_STRING:0:-5}"
echo $TEST
mg_=`mysql -u$dbUser -p$dbPass -e "SET SESSION group_concat_max_len = 200000; SELECT CONCAT('DROP TABLE ', GROUP_CONCAT(table_name) , ';') FROM information_schema.tables WHERE $TEST;" -s` echo $mg_
它返回NULL
結果是
mysqld is alive
table_schema = 'exclude_test' AND table_name LIKE 'mg_de_reifen_import_temp' AND table_schema = 'exclude_test' AND table_name LIKE 'mg_de_reifen_import' AND table_schema = 'exclude_test' AND table_name LIKE 'mg_de_reifen_import_last'
NULL