"make test" gives error: "Syntax error: "(" unexpected"
Issue #21
resolved
Full output:
#!
$ make test
cd test && ./sanity-test.sh
./sanity-test.sh: 3: ./sanity-test.sh: Syntax error: "(" unexpected
Makefile:44: recipe for target 'test' failed
make: *** [test] Error 2
Perhaps we're using different shells, or different shell versions? I'm using bash 4.4.
Comments (3)
-
reporter -
reporter - changed status to resolved
Run the test script using bash, not the default shell (fixes
#21)This is necessary because it uses some bash-specific syntax.
→ <<cset e62b905f5b30>>
-
reporter - changed component to test
- Log in to comment
So it turns out that, while bash 4.4 is what runs in my terminal, that's not what scripts run with by default. Scripts run with
/bin/sh
by default, and on my system,/bin/sh
is a symlink todash
, notbash
. The syntax you're using appears to be validbash
, but not validdash
.The solution in these cases is to add the following line at the beginning of the script:
which tells the invoking shell to run the script using
/bin/bash
, not the default/bin/sh
.