When editing a remote file with tramp, I want org-babel source blocks to source the remote machine's .bashrc.
I found this workaround that does what I want:
#+BEGIN_SRC bash :preamble ". ~/.bashrc"
echo $PATH
#+END_SRC
I can save a bit of typing by adding this to the top of the file, so it applies to all bash
blocks in the file:
:PROPERTIES:
:HEADER-ARGS:bash: :prologue ". ~/.bashrc"
:END:
However, what I really want is for the combination of tramp + org-babel to treat a shell source block as if I've started bash interactively on the remote machine.
Is there a way to configure this as the default, or is my hacky solution the best/only way to achieve my goal?
I tried the following suggestions, with no noticeable effect:
- https://emacs.stackexchange.com/a/62427/10036
- https://emacs.stackexchange.com/a/31624/10036
- https://emacs.stackexchange.com/a/46200/10036
[edit]
Based on one of the comments, I also tried adding this to my init file:
(add-to-list 'tramp-connection-properties
(list (regexp-quote "/sshx:ibp2-admin:")
"remote-shell" "/bin/bash"
"sh-extra-args" "-l -i"))
This makes the remote shell /bin/bash instead of /bin/sh, but did not source the ~/.bashrc file.