Hi everyone,

tl;dr: is there a way to have ob-shell (or some similar mode) run commands
one by one and include the commands, interspersed with their output, in the
#+RESULTS block?

I would like to have examples shown with commands, followed by their
output. Something like this:

#+begin_src console
> echo "hi"
hi
> echo "bye"
bye
#+end_src

This works well for my use case - "console" blocks are understood nicely by
Pygmentize as containing both commands and output.

What I would like is to start using org-babel to run the commands and
insert their output in the export, so that I can update the examples
without having to copy-paste from the terminal. So what I would like is to
have something like this:

#+begin_src sh :exports results :wrap "src console"
echo "hi"
echo "bye"
#+end_src

And when I evaluate the block with C-c C-c, I get:

#+results:
#+begin_src console
> echo "hi"
hi
> echo "bye"
bye
#+end_src

Before I start building my own, ob-mode I was wondering if anyone knows of
any existing way to achieve this.

Thanks!
--Diego

Reply via email to