I have a file, called a.r, it has a chmod of 755,
sayHello <- function(){
print(\'hello\')
}
sayHello()
Ho
You need the ?Rscript command to run an R script from the terminal.
Check out http://stat.ethz.ch/R-manual/R-devel/library/utils/html/Rscript.html
Example
## example #! script for a Unix-alike
#! /path/to/Rscript --vanilla --default-packages=utils
args <- commandArgs(TRUE)
res <- try(install.packages(args))
if(inherits(res, "try-error")) q(status=1) else q()