From 43393d220e4227bc5dfaa63ceb2c878bb3ff53d2 Mon Sep 17 00:00:00 2001 From: Eisuke Kawashima Date: Thu, 31 Jul 2025 17:24:37 +0900 Subject: [PATCH] Updated SC2236 (markdown) --- SC2236.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/SC2236.md b/SC2236.md index 8191745..52668e8 100644 --- a/SC2236.md +++ b/SC2236.md @@ -20,13 +20,15 @@ if [ -n "$STY" ]; then echo "You are already running screen"; fi You have negated `test -z` or `test -n`, resulting in a needless double-negative. You can just use the other operator instead: - # Identical tests to verify that a value is assigned - [ ! -z foo ] # Not has no value - [ -n foo ] # Has value +```sh +# Identical tests to verify that a value is assigned +[ ! -z foo ] # Not has no value +[ -n foo ] # Has value - # Identical tests to verify that a value is empty - [ ! -n foo ] # Not is non-empty - [ -z foo ] # Is empty +# Identical tests to verify that a value is empty +[ ! -n foo ] # Not is non-empty +[ -z foo ] # Is empty +``` ### Exceptions: