builtin
Bash test builtin
Evaluates an expression; 0 means true, 1 false, and invalid input can give a higher status. Each operand and operator is a separate argument.
Formal Syntax & Structure
bash syntaxbash
test expressionParameters & Attributes
| Name | Type | Description |
|---|---|---|
| expression | arguments | String, integer or file predicate. |
Return Value
exit status
Evaluates an expression; 0 means true, 1 false, and invalid input can give a higher status. Each operand and operator is a separate argument.
Working Example
Example Snippetbash
label=''if test -z "$label"; then printf '%s\n' empty; filabel='daily report'if [ -n "$label" ]; then printf '%s\n' present; fi