我的 aaa.sh
文件中有这两行:
#!/bin/bash
chmod +x /home/tot/*.html
当我在 AWS EC2 Linux 上运行它时:
$ sh aaa.sh
我收到这条消息:
chmod: cannot access ‘\r’: No such file or directory
最佳答案
您的文件中有 Windows 行结尾 (\r\n)。它需要有 Unix 风格的行结尾(仅\n)。
您可以使用常见的 dos2unix
实用程序或 vim 中的 set ff=unix
命令进行转换。
关于linux - chmod : cannot access ‘\r’ : No such file or directory,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22825460/