linux - chmod : cannot access ‘\r’ : No such file or directory

标签 linux bash

我的 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/

相关文章:

linux - 在 Linux 上运行 X-CTU

json - CentOS监控磁盘使用情况使用 'du'输出JSON

bash - 通过 stdin 处理输入但文件输入工作正常时出现意外行为

linux - 检查 docker-compose 服务是否正在运行

linux - omn​​et++ on ubuntu 14.06 make 文件错误

c# - ubuntu 中 kernel32.dll 的等价物是什么?

regex - foo[E1,E2,...]* glob 匹配所需的内容,但 foo[E1,E2,...]_* 不匹配?

bash - 查找不同路径 BASH 独有的文件

linux - awk 忽略打印单列。 sh-c

linux - upstart conf 文件等待进程