This happens when you are using the test
builtin via [
and your left side expression returns NUL. You can fix this by the use of:
if [ x`some | expression | here` = x1 ]; then
Or, since you're already using bash you can use its much nicer (( ))
syntax which doesn't have this problem and do:
if (( $(some | expression | here) == 1 )); then
Note that I also used $()
for command substitution over backticks `` as the latter is non-POSIX and deprecated