Search code examples
emacsenvironment-variableseshell

How to set an environment variable in emacs shell (eshell)?


I cannot seem to find this anywhere. A lot of times I run commands with an environment variable set like:

export BLA=foo && ./somebinary

How do i do this in eshell? I think the command is called set but i'm not sure how to use it, what would be the above equivalent in eshell?


Solution

  • ~ $ (setenv "XYZ" "abc")
    abc
    ~ $ ./e.sh
    abc
    ~ $ cat e.sh
    echo $XYZ
    ~ $ (setenv "XYZ" "abc")
    abc
    ~ $ ./e.sh
    abc