我的文件中有这两行aaa.sh:
#!/bin/bash\nchmod +x /home/tot/*.html\nRun Code Online (Sandbox Code Playgroud)\n\n当我在 AWS EC2 Linux 上运行它时:
\n\n$ sh aaa.sh\nRun Code Online (Sandbox Code Playgroud)\n\n我收到这条消息:
\n\nchmod: cannot access \xe2\x80\x98\\r\xe2\x80\x99: No such file or directory\nRun Code Online (Sandbox Code Playgroud)\n
您的文件中有 Windows 行结尾 (\r\n)。它需要有 Unix 风格的行结尾(仅 \n)。
dos2unix您可以使用常用实用程序或vim 中的命令进行转换set ff=unix。