I would like a shell script that launches a new terminal, opens the R environment in the terminal and executes commands in the R environment of the new terminal.
I found a similar Q in the below link,
[In order : launch new terminal, launch R environment in the new terminal, execute commands in R environment]
But the solution discussed in the thread (Rscript) doesn't work for me.
I'm trying to run the below code,
gnome-terminal -- /bin/sh -c 'R;Sys.getenv("PATH")'
But I'm getting an error when I use (Sys.getenv("PATH")) after R command. I guess it is due to /bin/sh.
gnome-terminal -- /bin/sh -c 'R'
When I run the above code, it opens another terminal and invokes R environment successfully.
Can someone advise how to execute multiple R commands in gnome-terminal.