I know that this is associated with a high risk of being a duplicate, but in none of the other questions here I found an answer to my problem. Below is a summary of what I have already tried.
I have an R script file.r :
#!/usr/bin/env Rscript print("Hello World!")
which is executable ( chmod +x file.r ) and which was used to work beautifully (the last time I used it about a month ago) by issuing:
$ ./file.r
However today:
$ ./file.r /usr/bin/env: 'Rscript\r': No such file or directory
Actually:
$ which Rscript /usr/bin/Rscript
So I changed shebang to: #!/usr/bin Rscript , but:
$ ./file.r /usr/bin: bad interpreter: Permission denied
Then I thought that I would run it as root, but:
$ sudo ./file.r sudo: unable to execute ./file.r: Permission denied
Looking through, I found that a new installation of R would solve my problem, so I did not install and installed R. Unfortunately, everything I wrote is still applicable. Please note, however, that the following versions of both versions of shebang:
$ Rscript file.r [1] "Hello World!"
What am I doing wrong?
source share