当前位置:网站首页>The SH runtime directly reported an error syntax error near unexpected token ` $'. \r‘

The SH runtime directly reported an error syntax error near unexpected token ` $'. \r‘

2022-06-25 20:56:00 Gem, Chaochao

After writing the script with a text editor , Upload to Linux,sh An error is reported directly during operation syntax error near unexpected token `$’\r’

Two solutions

The first one is

First step vim -b XXX.sh
You can see that there are more at the end of each line “”“^M” This thing

The second step sed -i ‘s/\r//g’ XXX.sh
It's settled.

The second kind

stay notepad++ in , edit -> Document format conversion -> convert to unix Format , That's all right. .

 Insert picture description here

原网站

版权声明
本文为[Gem, Chaochao]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202181337140869.html

随机推荐