wait-for-it icon indicating copy to clipboard operation
wait-for-it copied to clipboard

/wait-for-it.sh: 75: /wait-for-it.sh: Syntax error: "(" unexpected (expecting ";;")

Open ChadLei opened this issue 5 years ago • 11 comments

/wait-for-it.sh: 75: /wait-for-it.sh: Syntax error: "(" unexpected (expecting ";;") error when trying to build with a openjdk:8-jre image

ChadLei avatar Jul 02 '19 02:07 ChadLei

Hello @ChadLei, I had the same issue here but it was because I was executing the command with sh like this:

$ sh ./wait-for-it.sh www.google.com:80

I removed the sh command and it worked for me.

$ ./wait-for-it.sh www.google.com:80

baptooo avatar Jul 04 '19 08:07 baptooo

great tip thanks!

ChadLei avatar Jul 05 '19 16:07 ChadLei

I have a same problem. run sh ./wait-for-it.sh www.google.com:80 on openjdk:8-jre image.

Why I mast run sh command. Because there is not bash command

warthur1214 avatar Aug 02 '19 03:08 warthur1214

I got the exact same problem with alpine:3.7, when running

sh wait-for-it.sh www.google.com:80

I don't have bash installed, so the fix of @baptooo is not working for me. AS mentioned here the parenthesis are for executing sub-processes in bash. Any thoughts about how to solve that problem?

HasBert avatar Aug 04 '19 21:08 HasBert

@HasBert You need install bash. Try this:

apk add --no-cache bash
./wait-for-it.sh www.google.com:80

warthur1214 avatar Aug 05 '19 02:08 warthur1214

it works but the correct command is: apk add --no-cache bash

There was a typo in @warthur1214 suggestion cause of two add

identitymonk avatar Aug 07 '19 19:08 identitymonk

@identitymonk sorry to puzzle you. I forgot to remove 'add'

warthur1214 avatar Aug 09 '19 07:08 warthur1214

Would it not be cleaner to make the script compatible with sh rather than enforce bash on minimalistic containers? Any thoughts?

mikaelengstrom avatar Sep 11 '20 20:09 mikaelengstrom

If you get this error while being sure you're running this with bash, make sure the first line of the script contains the shebang. (I put a link to the repo as a comment as the first line :sweat_smile: )

srdecny avatar Sep 15 '20 19:09 srdecny

maybe this will work: https://github.com/vishnubob/wait-for-it/pull/80

pjebs avatar Dec 14 '20 01:12 pjebs

maybe this will work: #80

The ash script worked!

azhar1038 avatar Jul 12 '23 02:07 azhar1038