这类问题经常出现在使用不同系统或机器编写、修改脚本时,由于换行符不一致导致该问题出现
解决方案:
Remove trailing \r character that causes this error:
sed -i 's/\r$//' filename
Explanation:
Option -i is for in-place editing, we delete the trailing \r directly in the input file. Thus be careful to type the pattern correctly.
本文介绍了解决因不同系统间换行符不一致导致脚本错误的方法。通过使用sed命令,可以有效地移除文件末尾的
字符,确保脚本能够在目标环境中正确运行。
4264

被折叠的 条评论
为什么被折叠?



