My makefile is as follows:
test:
if [ "a" == "a" ]; then echo "hooray"; fi
running make test yields the following error:
/bin/sh: 1: [: a: unexpected operator
(Note, if I change the conditional to "a" == "b", the error still refers to "a", so the "problem" is (at least) with the first "a").
I feel like I must be missing something silly, but I cannot get this to work, and can't think of any way to further simplify the problem.
I'm on a raspberry pi (raspbian), running the default/latest everything (apt-get update && apt-get upgrade daily).
Gah. The clue is /bin/sh. apparently make doesn't use bash as its shell under my configuration? very strange...
Anyways, == isn't POSIX sh. Even this cheat sheet: https://www.joedog.org/articles-cheat-sheet/ gets it wrong (thank you Rebecca Cran, who commented as such a year ago...)
To be clear- the solution is to use a single =, as in:
test:
if [ "a" = "a" ]; then echo "hooray"; fi
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With