xszf

导航

bash hello.sh文件出现hello.sh: 行 4: $'\r': 未找到命令 hello.sh: 行 8: $'\r': 未找到命令

因为你的脚本文件使用了 Windows 格式的换行符(CRLF),而 Linux 系统需要 Unix 格式的换行符(LF)。
解决方法:
vim hello.sh

在 vim 中输入

:set fileformat=unix
:wq

posted on 2025-10-23 16:33  xszf  阅读(8)  评论(0)    收藏  举报