shebang 行在 R 脚本中不起作用 [英] shebang line not working in R script

查看:26
本文介绍了shebang 行在 R 脚本中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下脚本

#!/usr/bin/Rscript

print ("shebang works")

在一个名为 shebang.r 的文件中.当我使用 Rscript 从命令行运行它时,它可以工作

in a file called shebang.r. When I run it from command line using Rscript it works

$ Rscript shebang.r

但是当我单独从命令行运行它时

but when I run it from the command line alone

$ shebang.r

它不起作用.未找到 shebang.r 命令.

It doesn't work. shebang.r command not found.

如果我打字(基于我见过的其他例子)

If I type (based on other examples I've seen)

$ ./shebang.r

我的权限被拒绝.

是的,Rscript 位于/usr/bin 目录

Yes, Rscript is located in /usr/bin directory

推荐答案

使文件可执行.

chmod 755 shebang.r

这篇关于shebang 行在 R 脚本中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆