[ false ]is true. Remove the brackets
if [ false ] then echo "triggers anyways" fi
if false then echo "never triggers" fi
[ str ] checks whether
str is non-empty. It doesn't matter if
false, it will still be evaluated for non-emptyness.
Instead, use the command
false which -- as the manual puts it -- does nothing, unsuccessfully.
ShellCheck is a static analysis tool for shell scripts. This page is part of its documentation.