From f9942d53db8fc188a002a8d285c7a656ac306fb3 Mon Sep 17 00:00:00 2001 From: Ryan Wagner Date: Wed, 11 Oct 2023 17:42:58 -0400 Subject: [PATCH] [CMSP-678]: Shellcheck --- bin/behat-cleanup.sh | 2 +- bin/behat-prepare.sh | 2 +- bin/behat-test.sh | 2 +- bin/full-teardown-wp-tests.sh | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/behat-cleanup.sh b/bin/behat-cleanup.sh index 451093c..8228e96 100755 --- a/bin/behat-cleanup.sh +++ b/bin/behat-cleanup.sh @@ -4,7 +4,7 @@ # Delete the Pantheon site environment after the Behat test suite has run. ### -if [ "$(terminus whoami)" -ne 0 ]; then +if ! "$(terminus whoami)"; then echo "Terminus unauthenticated; assuming unauthenticated build" exit 0 fi diff --git a/bin/behat-prepare.sh b/bin/behat-prepare.sh index e2393a2..6f3de7c 100755 --- a/bin/behat-prepare.sh +++ b/bin/behat-prepare.sh @@ -6,7 +6,7 @@ # such that it can be run a second time if a step fails. ### -if [ "$(terminus whoami)" -ne 0 ]; then +if ! "$(terminus whoami)"; then echo "Terminus unauthenticated; assuming unauthenticated build" exit 0 fi diff --git a/bin/behat-test.sh b/bin/behat-test.sh index 4026b1a..20616d1 100755 --- a/bin/behat-test.sh +++ b/bin/behat-test.sh @@ -4,7 +4,7 @@ # Execute the Behat test suite against a prepared Pantheon site environment. ### -if [ "$(terminus whoami)" -ne 0 ]; then +if ! "$(terminus whoami)"; then echo "Terminus unauthenticated; assuming unauthenticated build" exit 0 fi diff --git a/bin/full-teardown-wp-tests.sh b/bin/full-teardown-wp-tests.sh index d0b90d6..f6396e4 100755 --- a/bin/full-teardown-wp-tests.sh +++ b/bin/full-teardown-wp-tests.sh @@ -27,7 +27,7 @@ drop_db() { local EXTRA="" if [ -n "$DB_HOSTNAME" ] ; then - if [ $(echo "$DB_SOCK_OR_PORT" | grep -e '^[0-9]\{1,\}$') ]; then + if echo "$DB_SOCK_OR_PORT" | grep -q -e '^[0-9]\{1,\}$'; then EXTRA=" --host=$DB_HOSTNAME --port=$DB_SOCK_OR_PORT --protocol=tcp" elif [ -n "$DB_SOCK_OR_PORT" ] ; then EXTRA=" --socket=$DB_SOCK_OR_PORT"