Open leangjia opened 1 month ago
When you see error messages like this:
-bash: '\r': command not found
Try running the dos2unix
command on the file.
Why? Windows style newline characters cause this error in Linux.
The dos2unix
command modifies the newline characters so they are Linux compatible.
(CAUTION: the dos2unix
command modifies files in place, so take precaution if necessary. If you need to keep the original file, you should make a backup copy first.)
Then, you can run the .sh
file without that error.
linux执行sh脚本报错:$’\r’: 未找到命令的解决