From 479e46815c308613be3b74bbbf7e6a5357c8f459 Mon Sep 17 00:00:00 2001 From: Daniel <daniel@harvey> Date: Thu, 13 Aug 2020 07:55:17 +0200 Subject: [PATCH] STY: Bash style changes to utils/make_db. --- utils/make_db | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/utils/make_db b/utils/make_db index 007b72b..93a62ea 100755 --- a/utils/make_db +++ b/utils/make_db @@ -56,7 +56,10 @@ function _execute_tests () { for tfile in $TESTS ; do echo "Running $tfile" echo "----- $tfile -----" >> .TEST_RESULTS - cat $tfile | $MYSQL_CMD -D $UNITTEST_DATABASE $(get_db_args_nodb) --disable-pager --batch --raw --skip-column-names --unbuffered >> .TEST_RESULTS 2>&1 + < $tfile $MYSQL_CMD \ + -D $UNITTEST_DATABASE $(get_db_args_nodb) --disable-pager \ + --batch --raw --skip-column-names --unbuffered \ + >> .TEST_RESULTS 2>&1 done; popd @@ -70,7 +73,7 @@ function _execute_tests () { # optional parameter: [--fresh] for installing a fresh data base. Otherwise an existing one would be reused. function _install_unit_test_database () { DATABASE_NAME=$UNITTEST_DATABASE - if [[ "$1" == "--fresh" ]] ; then + if [[ $1 = "--fresh" ]] ; then if _db_exists "$DATABASE_NAME"; then drop "$DATABASE_NAME" ; fi @@ -144,7 +147,7 @@ function grant() { echo read -p "Please repeat the password: " -s password2 echo - [[ "$password" == "$password2" ]] && { + [[ "$password" = "$password2" ]] && { DATABASE_USER_PW="$password" break } @@ -152,10 +155,10 @@ function grant() { done fi - if [[ "$1" == "--strict" ]] ; then + if [[ $1 = "--strict" ]] ; then for host in ${DATABASE_USER_HOST_LIST//,/ } ; do CMD="SELECT COUNT(*) FROM mysql.user WHERE user='${DATABASE_USER}' AND host='${host}';" - [[ $($MYSQL_CMD $(get_mysql_args_nodb) -s -N -e "$CMD") == 0 ]] || { + [[ $($MYSQL_CMD $(get_mysql_args_nodb) -s -N -e "$CMD") = 0 ]] || { echo "The user '${DATABASE_USER}@${host}' is already in the database." echo "Please use another user or delete it, e.g. with" echo "'mysql -u ${MYSQL_USER} -p -e \"DROP USER ${DATABASE_USER}@${host};\"'" -- GitLab