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: Bruno Barbier
Subject: Re: Issue with setting environment variables in Org-mode shell blocks via TRAMP
Date: Sat, 28 Dec 2024 19:12:07 +0100

Hello,

Michael Albinus <michael.albinus@gmx.de> writes:

> Bartosz Kaczyński <bkaczynski@posteo.net> writes:
>
>>
>> To work around this, I have tried forcing the remote shell to be 
>> interactive by modifying the TRAMP settings:
>>

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.

If an org babel session is not an option for you, you might consider
asking to the org mailing list, to have better answers from org experts
(as it looks like TRAMP is just doing what Org is asking for).

HTH,

Bruno



reply via email to

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