"make test" gives error: "Syntax error: "(" unexpected"

Issue #21 resolved
Botond Ballo repo owner created an issue

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)

  1. Botond Ballo reporter

    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 to dash, not bash. The syntax you're using appears to be valid bash, but not valid dash.

    The solution in these cases is to add the following line at the beginning of the script:

    #!/bin/bash
    

    which tells the invoking shell to run the script using /bin/bash, not the default /bin/sh.

  2. Log in to comment