Menu

#84 test [ with == fails with error : = not found

open
nobody
Core shell (16)
5
2013-01-25
2012-12-18
No

A simple test like:

if [ "$1" == "-h" ]; then
echo "Fail"
fi

fails with the error "zsh: = not found", even though == claims to be the preferred test mechanism. The same statement with double brackets [[ ]] works and single = also works. The construct with single bracket [ and double equals == works fine in bash.

Discussion