From 0b58a56637c69e0d346604e73e21ad8302a73818 Mon Sep 17 00:00:00 2001 From: Joakim Roubert Date: Fri, 15 May 2020 21:03:06 +0200 Subject: [PATCH] Use -n instead of ! -z in shell scripts (#4404) Signed-off-by: Joakim Roubert --- bin/_test-run.sh | 2 +- bin/fmt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/_test-run.sh b/bin/_test-run.sh index eef778688..512474c86 100755 --- a/bin/_test-run.sh +++ b/bin/_test-run.sh @@ -136,7 +136,7 @@ check_if_k8s_reachable(){ remove_l5d_if_exists() { resources=$(kubectl --context=$k8s_context get all,clusterrole,clusterrolebinding,mutatingwebhookconfigurations,validatingwebhookconfigurations,psp,crd -l linkerd.io/control-plane-ns --all-namespaces -oname) - if [ ! -z "$resources" ]; then + if [ -n "$resources" ]; then printf 'Removing existing l5d installation...' cleanup printf '[ok]\n' diff --git a/bin/fmt b/bin/fmt index baf424512..2cd3fa432 100755 --- a/bin/fmt +++ b/bin/fmt @@ -10,7 +10,7 @@ dirs=$(go list -f \{\{.Dir\}\} ./... | grep -v controller/gen) # dedup them. files=$(bin/goimports -l $dirs | sort | uniq) -if [ ! -z "$files" ]; then +if [ -n "$files" ]; then for file in $files; do bin/goimports -d "$@" "$file" done