Reputation: 9183
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
?
Upvotes: 18
Views: 7258
Reputation: 1272
I set variables in my bash profile like so:
export WORK_DIR=/Users/me/Documents/some/dir
Then in .emacs I put this:
(let ((work_dir (shell-command-to-string ". ~/.bash_profile; echo -n $WORK_DIR")))
(setenv "WORK_DIR" work_dir))
Upvotes: 3
Reputation: 28752
~ $ (setenv "XYZ" "abc")
abc
~ $ ./e.sh
abc
~ $ cat e.sh
echo $XYZ
~ $ (setenv "XYZ" "abc")
abc
~ $ ./e.sh
abc
Upvotes: 23