Pregunta:
Intento canalizar la salida de un bloque fuente al siguiente bloque fuente como entrada estándar. Aquí un ejemplo de lo que tengo hasta ahora:
Create stdin data:
#+header: :exports code
#+header: :results output
#+begin_src sh
echo "That goes to the next"
#+end_src
#+name: piped
#+RESULTS:
: That goes to the next
Use "piped" as stdin:
#+header: :exports results
#+header: :stdin piped
#+header: :results output
#+begin_src sh
VALUE=$(cat)
echo "I got:"
echo "$VALUE"
#+end_src
Mis problemas con esto son:
-
Tengo que crear manualmente el resultado del primer bloque presionando
Cc Cc
-
el resultado debe incluirse en org-buffer (de lo contrario, no se necesita una salida grande)
-
el resultado debe nombrarse manualmente
¿Existe una solución alternativa o una mejor manera de hacer esto?
Respuesta:
Aquí hay una forma simple de arreglar su código nombrando el bloque src en lugar de resultados:
#+name: piped
#+header: :exports code
#+header: :results output
#+begin_src sh
echo "That goes to the next"
#+end_src
#+RESULTS:
: That goes to the next
#+header: :exports results
#+header: :stdin piped
#+header: :results output
#+begin_src sh
VALUE=$(cat)
echo "I got:"
echo "$VALUE"
#+end_src
#+results:
: I got:
: That goes to the next