-
Notifications
You must be signed in to change notification settings - Fork 1.8k
SC1033
John Gardner edited this page Dec 22, 2021
·
3 revisions
(or SC1034 for vice versa)
[[ -z "$var" ]
[[ -z "$var" ]]
ShellCheck found a test expression [ ... ]
(POSIX) or [[ ... ]]
(ksh/bash), but where the opening and closing brackets did not match (i.e. [[ .. ]
or [ .. ]]
). The brackets need to match up to work.
Note in particular that [..]
do not work like parentheses in other languages. You can not do:
# Invalid
[[ x ] || [ y ]]
You would instead use two separate test expressions joined by ||
:
# Valid basic test expressions (sh/bash/ksh)
[ x ] || [ y ]
# Valid extended test expressions (bash/ksh)
[[ x ]] || [[ y ]]
None
- Help by adding links to BashFAQ, StackOverflow, man pages, POSIX, etc!