From 867b9cb102f791cd0ecb8e616d2a6be6658703d6 Mon Sep 17 00:00:00 2001 From: Darko Poljak Date: Fri, 15 Feb 2019 20:40:12 +0100 Subject: [PATCH] shellcheck: SC2236: use -n instead of ! -z --- cdist/conf/type/__package_emerge/gencode-remote | 2 +- cdist/conf/type/__systemd_unit/gencode-remote | 2 +- cdist/conf/type/__zypper_repo/gencode-remote | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cdist/conf/type/__package_emerge/gencode-remote b/cdist/conf/type/__package_emerge/gencode-remote index b144ede4..e1b85ebb 100755 --- a/cdist/conf/type/__package_emerge/gencode-remote +++ b/cdist/conf/type/__package_emerge/gencode-remote @@ -58,7 +58,7 @@ fi # Exit if nothing is needed to be done [ "$state_is" = "$state_should" ] && { [ -z "$version" ] || [ "$installed_version" = "$version" ]; } && exit 0 -[ "$state_should" = "absent" ] && [ ! -z "$version" ] && [ "$installed_version" != "$version" ] && exit 0 +[ "$state_should" = "absent" ] && [ -n "$version" ] && [ "$installed_version" != "$version" ] && exit 0 case "$state_should" in diff --git a/cdist/conf/type/__systemd_unit/gencode-remote b/cdist/conf/type/__systemd_unit/gencode-remote index 60486c52..967a6c87 100644 --- a/cdist/conf/type/__systemd_unit/gencode-remote +++ b/cdist/conf/type/__systemd_unit/gencode-remote @@ -23,7 +23,7 @@ state=$(cat "${__object}/parameter/state") current_enablement_state=$(cat "${__object}/explorer/enablement-state") if [ "${state}" = "absent" ]; then - if [ ! -z "${current_enablement_state}" ]; then + if [ -n "${current_enablement_state}" ]; then echo "systemctl --now disable ${name}" echo "rm -f /etc/systemd/system/${name}" echo "systemctl daemon-reload" diff --git a/cdist/conf/type/__zypper_repo/gencode-remote b/cdist/conf/type/__zypper_repo/gencode-remote index b8eeef0f..336488ae 100755 --- a/cdist/conf/type/__zypper_repo/gencode-remote +++ b/cdist/conf/type/__zypper_repo/gencode-remote @@ -74,19 +74,19 @@ case "$state" in fi ;; absent) - if [ ! -z "$act_id" ]; then + if [ -n "$act_id" ]; then # Repo present (act_id not ""), so we ned to delete it echo "zypper $zypper_def_opts removerepo $act_id" fi ;; enabled) - if [ ! -z "$act_id" ] && [ "$repostate" = "disabled" ]; then + if [ -n "$act_id" ] && [ "$repostate" = "disabled" ]; then # Repo present (act_id not "") and repostate not enabled, so a enable call is needed echo "zypper $zypper_def_opts modifyrepo -e $act_id" fi ;; disabled) - if [ ! -z "$act_id" ] && [ "$repostate" = "enabled" ]; then + if [ -n "$act_id" ] && [ "$repostate" = "enabled" ]; then # Repo present (act_id not "") and repostate enabled, so a disable call is needed echo "zypper $zypper_def_opts modifyrepo -d $act_id" fi