12

i am facing this issue

sparsh610@DESKTOP-551C51M:/mnt/e/xxxxxxxxx$ ./gradlew mm
: not found2: ./gradlew:
: not found8: ./gradlew:
./gradlew: 52: ./gradlew: Syntax error: word unexpected (expecting "in")

i verified that my system has gradle installed and with all the read write access.

any specific reason for this error ?

Already checked this link

sparsh610
  • 1,552
  • 3
  • 27
  • 66

1 Answers1

19

Its simply a difference between UNIX and windows handling end of line character, so easy to solve just type sed -i.bak 's/\r$//' gradlew this will replace the carriage return. With the option -i, the file will be edited in-place, and the original file will be backed up as gradlew.bak

kusiroll
  • 374
  • 5
  • 9
  • 2
    ... or just use Notepad++ to do a conversion, anyway - thanks so much! – Konrad Mar 25 '20 at 11:01
  • Can you elaborate more each syntax? It works for me but I have no idea why... – Edison Pebojot Jan 11 '21 at 07:51
  • I noticed that bash has some issues when lines terminate with \r\n instead of \n. Bash tries to interpret \r as a char belonging to the command, causing errors that are very difficult to understand. – Daniel Ferber Feb 06 '21 at 20:38