[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: processing a literal example line by line in a shell source block?
From: |
Ihor Radchenko |
Subject: |
Re: processing a literal example line by line in a shell source block? |
Date: |
Thu, 03 Nov 2022 07:41:03 +0000 |
Greg Minshall <minshall@umich.edu> writes:
> hi. i have a text in a named #+begin_example ... #+end_example block.
> i would like to process this text line by line in a shell (bash, say)
> code block. but, it appears that the individual lines are not
> separated, but passed as one long string to the source block. (example
> below.)
>
> is there a magic incantation i can use to accomplish this?
Try
#+name: lbl
#+begin_example
line 1
line 2
#+end_example
#+begin_src bash :var input=lbl :results output
echo "${input}"
#+end_src
#+RESULTS[719e61ee2f3fb87459530cf75b7bbef74b7d4337]:
: line 1
: line 2
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>