Reputation: 839
I have a Rscript which generates several variables. I would like to import one of these variables into a bash loop? Is it possible?
My variable is variable
and I want to import it like this :
for i in variable
do <command line>
done
I do not want to save variable
into a file and reload this .
Is there a solution?
Upvotes: 1
Views: 72
Reputation: 59110
You can have the R script print out the content of the variable and use a construct like this:
VAR=$(Rscript myscript.R)
for i in $VAR
do <command line>
done
Upvotes: 1