Hi Barry

Thank you very much for your reply. I changed my scripts according to your
suggestions - this is how they look now:

#!/bin/bash

VARIABLES=( a b c d )

for i in ${VARIABLES[@]}; do
      export VARIABLENAME=$i
      Rscript -e 'source("myscript.R")'
done 

and in the R program, I used
args <- Sys.getenv("VARIABLENAME")  instead of args <- commandArgs(TRUE)

But when I add the "R --slave", the program hangs, so I left it out (you
said it was just to cut out the startup messages, so I assumed it shouldn't
really matter). It's still not working, though. There is no error message,
but the R program still doesn't seem to be executed (@Krzysztof: The R
program makes plots - since these plots are not produced,  I figured that
something with the call of myscript.R is not working)

Any ideas or suggestions?




--
View this message in context: 
http://r.789695.n4.nabble.com/export-variable-from-bash-to-R-tp4647749p4647866.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to