1

Among other parameters, the Emacs setup I'm using contains the instruction

(org-babel-do-load-languages
  'org-babel-load-languages
  '((emacs-lisp . t)
  (python . t)
  (shell . t)
  (ditaa . t)))

When using org-mode to document and deploy small snippets of code, I noticed the evaluation by C-c C-c works both for invoking the sh argument the manual explicitly mentions, e.g. for

  #+begin_src sh :exports both :results output
tree -d -L 1
  #+end_src

as well as an instruction with bash of

  #+begin_src bash :exports both :results output
tree -d -L 1
  #+end_src

The question: should I use only sh (for shell) to retain portability instead for bash?

1
2

I don't think there is a general answer to your question. It's up to your personal circumstances and preferences. If these are snippets that you use on your own computer, or on systems where you can count on bash being present, then there's no reason not to use bash. If they need to be portable across systems that may or may not have bash, then of course you should stick to sh.

I don't think there's any additional considerations added to the decision by using Emacs/orgmode.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.