shebang line not working in R script

Milktrader picture Milktrader · Jun 27, 2010 · Viewed 8.7k times · Source

I have the following script

#!/usr/bin/Rscript

print ("shebang works")

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

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

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

$ ./shebang.r

I get permission denied.

Yes, Rscript is located in /usr/bin directory

Answer

Sjoerd picture Sjoerd · Jun 27, 2010

Make the file executable.

chmod 755 shebang.r