简体   繁体   中英

Shell bash script does not run R

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM