Gradlew causes 158 error on Ubuntu Linux

not-a-bug

(Andrew Soloninka) #1

I try to run gradlew on my Umbutu Linux server using the command
sudo sh gradlew tasks
I get the following error:
gradlew: 158: gradlew: Syntax error: "(" unexpected

Gradle Version: 3.0
Operating System: Umbutu Linux 14.04.4
Is this a regression? No If yes, which version of Gradle do you know it last worked for?


(davidmichaelkarr) #2

First of all, it’s “Ubuntu”, not “Umbuntu”.

Can you try doing “sudo ./gradlew tasks”? The gradlew script is typically a Bash script, and I’m not sure what it would do if run from Bourne shell (I couldn’t get this error in my own testing).

I assume you have a specific reason for sudoing that.


(Stefan Wolf) #3

Hi Andrew,

I think the main problem would be that on Ubuntu, by default, the root shell is Dash - which is not Bash compliant. Our gradlew shell script does not yet support that. There is an open pull request to add support, but it has been stalled for some time.

To fix your problem it would probably be enough to run

sudo bash gradlew tasks

Does this fix this for you?

Regards,
Stefan


(Andrew Soloninka) #4

Yes Stefan, That worked.

Thanks