Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env bash
- value=""
- if [ -n $value ]
- then
- echo "value is non-zero"
- fi
- #!/usr/bin/env bash
- value=""
- if [[ -n $value ]]
- then
- echo "value is non-zero"
- fi
- [[ expression ]]
- Return a status of 0 or 1 depending on the evaluation of the conditional expression expression. Expressions are composed of the pri‐
- maries described below under CONDITIONAL EXPRESSIONS. Word splitting and pathname expansion are not performed on the words between
- the [[ and ]]; tilde expansion, parameter and variable expansion, arithmetic expansion, command substitution, process substitution,
- and quote removal are performed. Conditional operators such as -f must be unquoted to be recognized as primaries.
- test "$1"
- test ! "$1"
- test -n "$1"
- test -z "$1"
- [ "-${z:-n}" "$var" ]
- [[ "-${z:-n}" "$var" ]]
Add Comment
Please, Sign In to add comment