diff --git a/bash.md b/bash.md index dec1310281..712ec5ea11 100644 --- a/bash.md +++ b/bash.md @@ -99,6 +99,8 @@ if [[ -z "$string" ]]; then elif [[ -n "$string" ]]; then echo "String is not empty" fi +[[ -z ${string} ]] && echo "String is empty" # one line if condition +[[ $? -eq 0 ]] || echo "Instruction failed" # one line else condition ``` See: [Conditionals](#conditionals)