[sr-dev] git:5.1:e5d94d3a: utils: Change sh(1) "test ==" usage to "="

Henning Westerholt hw at skalatan.de
Fri Nov 29 18:43:32 CET 2019


Module: kamailio
Branch: 5.1
Commit: e5d94d3a8c9ce2962c03b130972715785652b605
URL: https://github.com/kamailio/kamailio/commit/e5d94d3a8c9ce2962c03b130972715785652b605

Author: Greg Troxel <gdt at lexort.com>
Committer: Henning Westerholt <hw at skalatan.de>
Date: 2019-11-29T18:43:20+01:00

utils: Change sh(1) "test ==" usage to "="

The POSIX sh(1) specification says that strings are compared with
test(1) (also "[") with "=".  Bash accepts "==" and this leads to
non-portable code.  This commit simply changes "==" within test/[ to
"=".

(cherry picked from commit e8b8251f6c7382f8e373c2b309422973a3bf730d)

---

Modified: utils/kamctl/kamdbctl

---

Diff:  https://github.com/kamailio/kamailio/commit/e5d94d3a8c9ce2962c03b130972715785652b605.diff
Patch: https://github.com/kamailio/kamailio/commit/e5d94d3a8c9ce2962c03b130972715785652b605.patch

---

diff --git a/utils/kamctl/kamdbctl b/utils/kamctl/kamdbctl
index ea15329a19..a8b0f60e7b 100755
--- a/utils/kamctl/kamdbctl
+++ b/utils/kamctl/kamdbctl
@@ -153,7 +153,7 @@ kamailio_dump()  # pars: <database name>
 		merr "kamailio_dump function takes two param"
 		exit 1
 	fi
-	if [ "$USED_DBENGINE" == "oracle" ]; then
+	if [ "$USED_DBENGINE" = "oracle" ]; then
 		oracle_dump $1 $2
 	elif [ "$PW" = "" ] ; then
 		$DUMP_CMD $1 > $2
@@ -174,7 +174,7 @@ kamailio_restore() #pars: <database name> <filename>
 		merr "kamailio_restore function takes two params"
 		exit 1
 	fi
-	if [ "$USED_DBENGINE" == "oracle" ]; then
+	if [ "$USED_DBENGINE" = "oracle" ]; then
 		oracle_restore $1 $2
 	else
 		sql_query $1 < $2
@@ -313,7 +313,7 @@ case $1 in
 		;;
 	copy)
 		# copy database to some other name
-		if [ "$USED_DBENGINE" == "berkeley" -o "$USED_DBENGINE" == "dbtext" ] ; then
+		if [ "$USED_DBENGINE" = "berkeley" -o "$USED_DBENGINE" = "dbtext" ] ; then
 			merr "$USED_DBENGINE don't support this operation"
 			exit 1
 		fi
@@ -346,7 +346,7 @@ case $1 in
 		exit $ret
 		;;
 	backup)
-		if [ "$USED_DBENGINE" == "berkeley" -o "$USED_DBENGINE" == "dbtext" ] ; then
+		if [ "$USED_DBENGINE" = "berkeley" -o "$USED_DBENGINE" = "dbtext" ] ; then
 			merr "$USED_DBENGINE don't support this operation"
 			exit 1
 		fi
@@ -360,7 +360,7 @@ case $1 in
 		exit $?
 		;;
 	restore)
-		if [ "$USED_DBENGINE" == "berkeley" -o "$USED_DBENGINE" == "dbtext" ] ; then
+		if [ "$USED_DBENGINE" = "berkeley" -o "$USED_DBENGINE" = "dbtext" ] ; then
 			merr "$USED_DBENGINE don't support this operation"
 			exit 1
 		fi




More information about the sr-dev mailing list