Passing arguments from a call to a bash script to an Rscript
bash, r, ubuntu
Solution
You can have bash pass all the arguments to the R script using something like this for a bash script:
#!/bin/bash
Rscript /path/to/R/script --args "$*"
exit 0
You can then choose how many of the arguments from $* need to be discarded inside of R.
Problem
I have a bash script that does some things and then calls Rscript. Here a simple example to illustrate: test.sh: ``` Rscript test.r ``` test.r: ``` args <- commandArgs() print(args) ``` How can I use `./test.sh hello` on the command line result in R printing hello?