1

I am running Mac OS High Sierra with RStudio.

I want to export a terminal set variable to RStudio, but echo and getenv currently show no output:

In terminal:

export testexpvar="testworks"

###I can echo in the terminal
echo $testexpvar
testworks

In RStudio console:

###I can't echo in R:
system("echo $testexpvar") ### no output at all

Sys.getenv("testexpvar")
[1] ""
Neal Barsch
  • 2,810
  • 2
  • 13
  • 39
  • Unless you are starting R or RStudio from the terminal *where you set the variable*, the variable is visible only to that process and children processes. Maybe this helps: https://stackoverflow.com/q/603785/3358272 – r2evans Oct 30 '18 at 03:08

0 Answers0