[英]chmod: cannot access ‘\r’: No such file or directory
I have these 2 line in my aaa.sh
file: 我在
aaa.sh
文件中有这两行:
#!/bin/bash
chmod +x /home/tot/*.html
When I run it on AWS EC2 Linux: 当我在AWS EC2 Linux上运行它时:
$ sh aaa.sh
I got this message: 我收到了这条消息:
chmod: cannot access ‘\r’: No such file or directory
You have Windows line endings in your file (\\r\\n). 您的文件中有Windows行结尾(\\ r \\ n)。 It needs to have Unix-style line endings (\\n only).
它需要具有Unix风格的行结尾(仅限\\ n)。
You can do the conversion with the common dos2unix
utility, or the set ff=unix
command in vim. 您可以使用常见的
dos2unix
实用程序或vim中的set ff=unix
命令进行转换。
chmod shouldn't care about the contents of your files. chmod不应该关心你文件的内容。 I bet you have a file with a control character in the filename itself.
我打赌你有一个文件名本身的控制字符文件。 Might display as a question mark, but
ls -b *.html
should show you the culprit. 可能会显示为问号,但
ls -b *.html
应该显示您的罪魁祸首。 Are your sure you want executable html files? 你确定要的是可执行的html文件吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.