Bruno Barbier <> writes:

> IIUC, the elisp expression:
>     (process-file "bash" "/tmp/")
> is more equivalent to:
>     cat /tmp/ | bash
> i.e. the shell is getting the commands from stdin.  Thus, any command
> that uses stdin might change what gets executed or not.

Looking at `org-babel-sh-evaluate', it should be enough to specify
:shebang, :cmdline, or :stdin header argument to force using script
rather than channel source block as input to bash:

#+begin_src shell :results output :cmdline bash
exec 0>&-
echo OK

: OK

#+begin_src shell :results output :cmdline bash
echo 1
read -p "Next command? " NEXT_COMMAND
echo 2
echo 3

: 1
: 2
: 3

I am wondering about the possible downsides of using script approach
instead of stdin redirection.

Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <>.
Support Org development at <>,
or support my work at <>

Reply via email to