Try the following source code blocks:

#+begin_src elisp
  (require 'ob-shell)
#+end_src

#+name: lbl
#+begin_example
line 1
line 2
#+end_example

#+begin_src bash :stdin lbl
  cat
#+end_src

Second one signals "Wrong number of arguments" at least in Emacs-26 with Org main HEAD.

Org bugfix branch works and yields

#+RESULTS:
| line | 1 |
| line | 2 |

I was going to suggest

#+begin_src bash :stdin lbl
  while read -r -a arr ; do
      echo "${arr[0]}"
  done
#+end_src
https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-shell.html

in response to Greg Minshall. processing a literal example line by line in a shell source block? Wed, 02 Nov 2022 11:17:25 -0700. https://list.orgmode.org/122789.1667413045@archlinux



Reply via email to