From fe96e5704fdefb9b8771c576ae15f2916e573acd Mon Sep 17 00:00:00 2001 From: Tim Hockin Date: Sun, 5 Mar 2023 15:14:43 -0800 Subject: [PATCH] bash: compare numbers numerically, not lexically Thanks, bash, for supporting < and > and making them NOT mean the obvious thing. [[ 2 < 10 ]] is false (( 2 < 10 )) is true --- hack/lib/logging.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hack/lib/logging.sh b/hack/lib/logging.sh index 8a175b3af4e..15a286cea78 100644 --- a/hack/lib/logging.sh +++ b/hack/lib/logging.sh @@ -130,7 +130,7 @@ kube::log::usage_from_stdin() { # Print out some info that isn't a top level status line kube::log::info() { local V="${V:-0}" - if [[ ${KUBE_VERBOSE} < ${V} ]]; then + if (( KUBE_VERBOSE < V )); then return fi @@ -158,7 +158,7 @@ kube::log::info_from_stdin() { # Print a status line. Formatted to show up in a stream of output. kube::log::status() { local V="${V:-0}" - if [[ ${KUBE_VERBOSE} < ${V} ]]; then + if (( KUBE_VERBOSE < V )); then return fi