[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bash source code block: problem after ssh commands
From: |
Ihor Radchenko |
Subject: |
Re: bash source code block: problem after ssh commands |
Date: |
Mon, 01 Jul 2024 16:01:49 +0000 |
Max Nikulin <manikulin@gmail.com> writes:
>> I guess not on Windows (bug#71081). But otherwise I agree.
>
> It was for starting mailcap viewer and Windows was not an issue.
bug#71081 is about shell-command-on-region, not about mailcap.
(and pty may actually not matter there, because Windows' cmd.exe is not
even POSIX-compient...)
> Some commands try to read standard input if it is available. In
> interactive sessions it may be hidden due to time interval between typed
> commands. Be careful when they are used in Org source blocks.
> [[https://mywiki.wooledge.org/BashFAQ/089][BASH FAQ #89]]
> warns concerning =ssh= and =ffmpeg=. Either explicitly specify
> =</dev/null= as input or use document here syntax.
>
> #+begin_example
> ssh example.org 'sed -i -e s/foo/bar/ file.txt' </dev/null
> ssh example.org 'tee >>file.log' <<"EOF"
> Added by org-babel
> EOF
> #+end_example
>
> (Quotes around "EOF" suppress variable expansion in the text.) Tools
> may have dedicated options, for example =ssh -n= is a more concise way
> to avoid the pitfall.
May you submit a patch for the WORG docs that documents this caveat?
--
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>