Comparing strings in bash script
bash
Solution
The problem is that `$platform` is an empty string. The usual workaround is to put it in quotes:
if [ "${platform}" == "macosx" ]
Example:
$ unset x
$ [ $x == 3 ]
-bash: [: ==: unary operator expected
$ [ "$x" == "3" ]
$
Problem
``` ./build_binaries.sh: line 43: [: ==: unary operator expected ``` I have this line (`line 43`) in my `bash script` which looks correct to me, but it keeps throwing error. ``` if [ ${platform} == "macosx" ]; then ``` Error: ``` ./foo.sh: line 43: [: ==: unary operator expected ``` This is on OSX.