builtin
Bash [ builtin
Equivalent to test with a required final ] argument. Quote operands and leave spaces around brackets.
Formal Syntax & Structure
bash syntaxbash
[ expression ]Return Value
exit status
Equivalent to test with a required final ] argument. Quote operands and leave spaces around brackets.
Working Example
Example Snippetbash
role=editorif [ "$role" = editor ]; then printf '%s\n' edit; fi