Bash script running error: '$'\r': No such file or directory

insert image description here
This kind of problem is common for my compatriots who like to use windows to edit the .sh file and then move it to the linux environment. Of course, you may also be a thieves in linux, just lazy

The cause of the problem :
The editing in windows may not meet the content format requirements of linux editing. It feels the same to the naked eye, but in fact we are always confused by the superficial phenomena of these two guys

Problem solving :
①Install sudo apt install dos2unix first
, the developer has already thought of our problem
②Run dos2unix xx.sh

If you bash again, there will be no error report

(over)

Guess you like

Origin blog.csdn.net/qq_43166192/article/details/109055522