shell script encountered a problem "$ '\ r': command not found"

: "Command not found $ '\ r'" record what the shell script problems encountered
when developing itself on windows10, written shell scripts to run linux without any problems, mac at home using their own update code during this epidemic, publication uses I met this problem:

File format problem (in the window and select mac is UTF-8, the result is still not entered into force on linux)

Two kinds of online methods, effective pro-test

method 1

a, linux installation dos2unix
b, yum install dos2unix
clear yum command Click on the reference
c, dos2unix XXX.sh

Method 2

a, direct use sed -i 's/\r$//' filename

Released seven original articles · won praise 8 · views 10000 +

Guess you like

Origin blog.csdn.net/weixin_42288822/article/details/104389209