emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to get shell source blocks to read my profile?


From: George Mauer
Subject: How to get shell source blocks to read my profile?
Date: Sun, 14 Mar 2021 16:30:42 -0500

I am confused why no matter how I try to run shell commands they seem to be missing variables exported in profiles.

I have added 3 variables to various startup scripts

  - ~./bash-profile~ :: ~export GIM_BASH_PROFILE="yes"~
  - ~./bashrc~ :: ~export GIM_BASHRC="yes"~
  - ~./zshrc~ :: ~export GIM_ZSHRC="yes"~

I am running emacs in GUI mode so I get why none of these are available *directly* in emacs, so then I try

  #+begin_src shell :results list
    env | grep GIM
  #+end_src

  #+RESULTS:

Ok that's kinda surprising, but I suppose it could be running ~/bin/zsh~ (that's my ~shell-file-name~) directly

what about

  #+begin_src shell :results list
    bash -c env | grep GIM
  #+end_src

  #+RESULTS:

That's pretty surprising. I would have expected running it directly to actually run my profile.

Shockingly

  #+begin_src shell :results list
    bash --rcfile ~/.bashrc -c env | grep GIM
  #+end_src

  #+RESULTS:

That is *still* nothing!

Sanity is restored slightly when I run

  #+begin_src shell :results list
    bash --login -c env | grep GIM
  #+end_src

which *does* indeed visit ~.bash_profile~ but only slightly.

What is going on, and is there a straightforward way in which I can get shell block to read from a profile?

reply via email to

[Prev in Thread] Current Thread [Next in Thread]