tramp-devel
[Top][All Lists]
Advanced

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

Re: Issue with setting environment variables in Org-mode shell blocks vi


From: Bartosz Kaczyński
Subject: Re: Issue with setting environment variables in Org-mode shell blocks via TRAMP
Date: Sun, 29 Dec 2024 09:09:30 +0000

On 12/28/24 19:12, Bruno Barbier wrote:

If you use a session (org babel), Org will make an interactive session
(bash), and bash will read the '.bashrc'.

Using heading properties, you could do something like:

   * your heading
      :PROPERTIES:
      :header-args:shell:  :dir /ssh:user@remotesrv|sudo:serviceuser@remotesrv:
      :header-args:shell+: :session "!sh serviceuser"
      :END:

      #+begin_src shell
      systemctl --user daemon-reload
      #+end_src

      #+begin_src shell
      an other command
      #+end_src


Without a session, Org is executing the code in a non-interactive way
(bash -c), and the ".bashrc" file isn't loaded.

Adding the :session option allowed the remote shell to maintain the environment variables, including XDG_RUNTIME_DIR, as expected.

Thank you once again for advice and I appreciate your support.

Best regards,
bartk



reply via email to

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