How to access a bash environment variable from within R in emacs-ess
In my .bashrc, I have the line: export SETTINGS=/home/user/settings.xml If I load R in bash, I can access this variable using the Sys.getenv function: Sys.getenv("SETTINGS") "/home/user/settings.xml" If I open up R in Emacs (M-x R), SETTINGS is empty: Sys.getenv("SETTINGS") "" What I have tried: adding the following to .emacs, based on How do I make Emacs recognize bash environment variables for compilation? ;; get environment vars from .bashrc (let ((path (shell-command-to-string ". ~/.bashrc; echo -n $SETTINGS"))) (setenv "SETTINGS" path)) opening up bash in emacs using M-x term echo