尝试在linux上运行shell脚本时“无法执行二进制文件”
发布时间:2020-12-14 02:07:43 所属栏目:Linux 来源:网络整理
导读:我是 linux和shell脚本编程的新手. 我试图使用以下命令从 Linux上的安全shell(ssh)运行一个shellcript: chmod +x path/to/mynewshell.shsh path/to/mynewshell.sh 我收到此错误: path/to/mynewshell.sh: path/to/mynewshell.sh: cannot execute binary fil
我是
linux和shell脚本编程的新手.
我试图使用以下命令从 Linux上的安全shell(ssh)运行一个shellcript: chmod +x path/to/mynewshell.sh sh path/to/mynewshell.sh 我收到此错误: path/to/mynewshell.sh: path/to/mynewshell.sh: cannot execute binary file. 尝试使用此命令: bash path/to/mynewshell.sh 我犯了同样的错误. 尝试使用此命令:su – myusername sh path / to / mynewshell.sh 1. cat -v path / to / mynewshell.sh的结果是: 2.当我尝试’less path / to / mynewshell.sh’时,我在终端上得到了这个: #!/bin/bash/Rscript^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@ ^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@ for dir in /path/to/* ; do ^@^@^@^@^@^@^@^@Rscript "$dir"/myRscript.R done 3.当我运行文件路径/到/ mynewshell.sh时:我得到了这个“Bourne-Again shell脚本文本可执行文件” 请提供有关如何尝试执行shellscript的任何建议. 解决方法
chmod -x从文件中删除执行权限.做这个:
chmod +x path/to/mynewshell.sh 并运行它 /path/to/mynewshell.sh 正如错误报告所说,你的脚本实际上不是一个脚本,它是一个二进制文件. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |