我对linux和shell编写非常陌生。我正在尝试使用以下命令从linux上的安全shell(ssh)运行shellscript:

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 询问我的密码并给我这个错误:no such file

or directory。

1. cat -v path / to / mynewshell.sh的结果是:^ @ ^ @ ^ @ ^ @ ^ @ ^ @ ^ @ ^ @

Rscript“ $ dir” /diver_script.R完成

2.当尝试’less path / to / mynewshell.sh’时,我在终端上得到了这个:

#!/bin/bash/Rscript^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@

^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@

for dir in /path/to/* ; do

^@^@^@^@^@^@^@^@Rscript "$dir"/myRscript.R

done

3.当我运行文件路径/to/mynewshell.sh时:我得到了这个“ Bourne-Again Shell脚本文本可执行文件”

请提供有关如何尝试执行Shellscript的任何建议。

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐