-4

I got these errors :syntax error near unexpected token `$'\r'' and $'\r': command not found I am using windows 10 and notepad++ editor running on cloud shell(https://ssh.cloud.google.com/cloudshell/)

wish
  • 41
  • 7

2 Answers2

0

error--> line 1: $' :\r': command not found

-->to resolve open this file with notepad++ then bottom right corner there is Windows(CLRF) option right click on it change to Unix(LF) and then run code.

This is for windows 10

enter image description here

wish
  • 41
  • 7
  • 2
    A much better solution is to not use a Windows editor in the first place. – tripleee Feb 19 '20 at 11:07
  • You didn't mention in your question that it is related to Windows. AFAIK Notepad++ is not available for UNIX. – Bodo Feb 19 '20 at 12:16
  • You are right. But I am using notepad++ on win10 and using cloud shell(https://ssh.cloud.google.com/cloudshell/) online editor – wish Feb 19 '20 at 13:10
  • @tripleee : Nearly every programmer's editor on Windows nowadays allows you to configure the line endings, in particular since most compilers/interpreters on Windows now also except LF as line terminator. I don't see a good reason not to use an editor made for Windows, if the user has other reasons to do the development in a Windows working environment. – user1934428 Feb 19 '20 at 14:20
0

apart from doing this in notepad++ you could simply run dos2unix on the shell script on unix directly

nullPointer
  • 4,188
  • 1
  • 14
  • 27