From: Andrei Pavel Date: Fri, 23 Dec 2016 14:47:05 +0000 (+0200) Subject: Brought bash code to Google coding standard X-Git-Tag: trac5524_base~16^2~12 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=25b65b4403d760eaa8aa084f3b2973a79a5bb2b8;p=thirdparty%2Fkea.git Brought bash code to Google coding standard --- diff --git a/src/bin/admin/admin-utils.sh b/src/bin/admin/admin-utils.sh index 3df7d4fc4e..5c8be36f9b 100755 --- a/src/bin/admin/admin-utils.sh +++ b/src/bin/admin/admin-utils.sh @@ -19,10 +19,10 @@ mysql_execute() { QUERY=$1 shift if [ $# -gt 1 ]; then - mysql -N -B $* -e "${QUERY}" + mysql -N -B "$@" -e "${QUERY}" retcode=$? else - mysql -N -B --user=$db_user --password=$db_password -e "${QUERY}" $db_name + mysql -N -B --database=${db_name} --user=${db_user} --password=${db_password} -e "${QUERY}" retcode="$?" fi @@ -48,11 +48,11 @@ pgsql_execute() { QUERY=$1 shift if [ $# -gt 0 ]; then - echo $QUERY | psql --set ON_ERROR_STOP=1 -A -t -h localhost -q $* + echo "${QUERY}" | psql --set ON_ERROR_STOP=1 -A -t -h localhost -q "#@" retcode=$? else export PGPASSWORD=$db_password - echo $QUERY | psql --set ON_ERROR_STOP=1 -A -t -h localhost -q -U $db_user -d $db_name + echo "${QUERY}" | psql --set ON_ERROR_STOP=1 -A -t -h localhost -q -U "${db_user}" -d "${db_name}" retcode=$? fi return $retcode @@ -72,11 +72,11 @@ pgsql_execute_script() { file=$1 shift if [ $# -gt 0 ]; then - psql --set ON_ERROR_STOP=1 -A -t -h localhost -q -f $file $* + psql --set ON_ERROR_STOP=1 -A -t -h localhost -q -f "${file}" "$@" retcode=$? else export PGPASSWORD=$db_password - psql --set ON_ERROR_STOP=1 -A -t -h localhost -q -U $db_user -d $db_name -f $file + psql --set ON_ERROR_STOP=1 -A -t -h localhost -q -U "${db_user}" -d "${db_name}" -f "${file}" retcode=$? fi return $retcode @@ -91,15 +91,15 @@ cql_execute() { query=$1 shift if [ $# -gt 1 ]; then - cqlsh $* -e "$query" + cqlsh "$@" -e "$query" retcode=$? else - cqlsh -u $db_user -p $db_password -k $db_name -e "$query" + cqlsh -u "${db_user}" -p "${db_password}" -k "${db_name}" -e "${query}" retcode=$? fi if [ $retcode -ne 0 ]; then - printf "cqlsh returned with exit status $retcode\n" + printf "cqlsh returned with exit status %s\n" "${retcode}" exit $retcode fi @@ -110,15 +110,15 @@ cql_execute_script() { file=$1 shift if [ $# -gt 1 ]; then - cqlsh $* -e "$file" + cqlsh "$@" -e "$file" retcode=$? else - cqlsh -u $db_user -p $db_password -k $db_name -f "$file" + cqlsh -u "${db_user}" -p "${db_password}" -k "${db_name}" -f "${file}" retcode=$? fi if [ $retcode -ne 0 ]; then - printf "cqlsh returned with exit status $retcode\n" + printf "cqlsh returned with exit status %s\n" "${retcode}" exit $retcode fi @@ -126,8 +126,8 @@ cql_execute_script() { } cql_version() { - version=`cql_execute "SELECT version, minor FROM schema_version" "$@"` - version=`echo "$version" | grep -A 1 "+" | grep -v "+" | tr -d ' ' | cut -d "|" -f 1-2 --output-delimiter="."` - echo $version + version=$(cql_execute "SELECT version, minor FROM schema_version" "$@") + version=$(echo "$version" | grep -A 1 "+" | grep -v "+" | tr -d ' ' | cut -d "|" -f 1-2 --output-delimiter=".") + echo "${version}" return $? }