emacsorg-modeorg-babel

org-babel shell always binds to "fish"


I have the excellent fish shell set as the default shell on my main laptop. For portability reasons (and editability reasons, as editing fish shell source blocks is buggy and slow) I'd still like to sometimes use sh or bash in my org-mode source blocks. It seems that org always resolves to fish, no matter what I try:

#+BEGIN_SRC sh
echo $SHELL
#+END_SRC

#+RESULTS:
: /usr/bin/fish

#+BEGIN_SRC bash
echo $SHELL
#+END_SRC

#+RESULTS:
: /usr/bin/fish

#+BEGIN_SRC fish
echo $SHELL
#+END_SRC

#+RESULTS:
: /usr/bin/fish

#+BEGIN_SRC shell
echo $SHELL
#+END_SRC

#+RESULTS:
: /usr/bin/fish

org-babel-shell-names is set to ("sh" "bash" "zsh" "fish" "csh" "ash" "dash" "ksh" "mksh" "posh"). How do I debug this? Or is there any way to set the shell to bash globally for org-babel? I'm using emacs 26.3 with the spacemacs configuration at commit 5fcd84d84 and latest org-mode.


Solution

  • I think you'll find that the SHELL environment variable isn't what you think it is.

    Try echoing $0 instead -- or running any built-in shell command which will give shell-specific output (bash has a help command, for example).