I have an R script that I can run with
R CMD BATCH Rtest.R a.txt
and it successfully returns the results to a.txt. I am attempting to write a new shell script that plan to run daily, and have made the following script, called morning
#!/bin/bash sh R CMD BATCH Rtest.R a.txt cat a.txt >> predicted.txt
I run this with the following commands
chmod 755 morning ./morning
I can get this to work sort of, but end up with the error
sh: 0: Can't open R
and execution halts midway through. When I run it with a different command (such as echo alpha > a.txt) it works as expected.
I am working under Ubuntu 14.04
No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 14.04.3 LTS Release: 14.04 Codename: trusty
Advertisement
Answer
In your morning
file. Please also check if R
is in the PATH
.
#!/bin/bash R CMD BATCH Rtest.R a.txt cat a.txt >> predicted.txt