\r character in shell script

后端 未结 6 1955
执笔经年
执笔经年 2020-11-30 05:05

I get the below error while trying to execute a shell script,

$\'\\r\': command not found: line 2:

Please suggest a solution for the same.

6条回答
  •  夕颜
    夕颜 (楼主)
    2020-11-30 05:53

    Your problem is that the file has Windows line endings. This can be caused by editing a file in Windows and trying to run it on a non-Windows system.

    You can fix this problem using dos2unix to convert the line endings:

    dos2unix ConstruedTermsXMLGenerator.sh
    

    The corresponding utility to convert in the other direction is unix2dos.

    Some systems have fromdos and todos.

提交回复
热议问题