From 0257280c2df935ed3b21c1d7605947c5549a6cdd Mon Sep 17 00:00:00 2001 From: Holger Just Date: Wed, 14 Feb 2018 16:14:13 +0100 Subject: [PATCH] Use = for [ ... ] tests instead of bash's == For Bash, the builtin command `test` resp. `[` accepts both `==` as well as `=` as an operator. POSIX however only specifies `=`. Thus, if the scripts are used with a `/bin/sh` which is not Bash, e.g. dash on Debian derivates, the test fail with: [: 1: unexpected operator This commit ensures that only the POSIX-conformiing operator `=` is used. For Bash, it doesn't make any difference, for other shells, it ensures that the scripts still work. --- nagios/bin/pmp-check-mysql-replication-delay | 2 +- nagios/bin/pmp-check-mysql-ts-count | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/nagios/bin/pmp-check-mysql-replication-delay b/nagios/bin/pmp-check-mysql-replication-delay index 1f02585..20bae29 100755 --- a/nagios/bin/pmp-check-mysql-replication-delay +++ b/nagios/bin/pmp-check-mysql-replication-delay @@ -73,7 +73,7 @@ main() { else NOW_FUNC='UNIX_TIMESTAMP(UTC_TIMESTAMP)' fi - if [ "${OPT_SRVID}" == "MASTER" ]; then + if [ "${OPT_SRVID}" = "MASTER" ]; then if [ "${MYSQL_CONN}" = 0 ]; then OPT_SRVID=$(awk '/Master_Server_Id/{print $2}' "${TEMP_SLAVEDATA}") fi diff --git a/nagios/bin/pmp-check-mysql-ts-count b/nagios/bin/pmp-check-mysql-ts-count index 06ea3f4..4bef803 100755 --- a/nagios/bin/pmp-check-mysql-ts-count +++ b/nagios/bin/pmp-check-mysql-ts-count @@ -61,10 +61,10 @@ main() { exit 1 fi fi - if [ "${OPT_TARGET}" == "kills" ]; then + if [ "${OPT_TARGET}" = "kills" ]; then OPT_TABLE="${OPT_TABLE:-percona.kill_log}" OPT_TIMESTAMP="${OPT_TIMESTAMP:-timestamp}" - elif [ "${OPT_TARGET}" == "fkerrors" ]; then + elif [ "${OPT_TARGET}" = "fkerrors" ]; then OPT_TABLE="${OPT_TABLE:-percona.foreign_key_errors}" OPT_TIMESTAMP="${OPT_TIMESTAMP:-ts}" else