2

I've got the following code:

#+NAME: example-block1
#+BEGIN_EXAMPLE
Lorem ipsum dolor sit amet, consectetur adipisicing elit.
#+END_EXAMPLE

#+NAME: example-block2
#+BEGIN_EXAMPLE
Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
#+END_EXAMPLE

#+NAME: my-shell-block
#+BEGIN_SRC sh :stdin example-block2
cat
#+END_SRC

#+CALL: my-shell-block()

Calling the "my-shell-block" with a hardcoded :stdin reference is no problem.

But now I want to set the :stdin dynamically in another "CALL":

#+CALL: my-shell-block(:stdin=example-block1)

This obviously does not work. Is there a way to dynamically change the ":stdin" of a shell code block?

2

:stdin isn't a argument as far as a function call is concerned. It's a special header argument which uses a slightly funky #+CALL syntax. Try:

#+CALL: my-shell-block[:stdin example-block1]()

Depending on your results setting you might want to force it to take output so it doesn't listify your results:

#+CALL: my-shell-block[:stdin example-block1 :results output]()

#+RESULTS:
: Lorem ipsum dolor sit amet, consectetur adipisicing elit.
  • @TessaLuniki: glad to be of help, if you are happy with the answer can you please accept it? – stsquad Dec 7 '18 at 14:52

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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