From mboxrd@z Thu Jan 1 00:00:00 1970 From: Diego Zamboni Subject: Re: How to intersperse commands with their output in RESULTS block? Date: Thu, 6 Feb 2020 21:45:19 +0100 Message-ID: References: <871rr86w8p.fsf@ucl.ac.uk> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000a98314059dee5a5c" Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:51694) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1izo1o-0007Fw-1R for emacs-orgmode@gnu.org; Thu, 06 Feb 2020 15:45:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1izo1m-0003b2-Ux for emacs-orgmode@gnu.org; Thu, 06 Feb 2020 15:45:35 -0500 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]:51365) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1izo1m-0003TF-Fa for emacs-orgmode@gnu.org; Thu, 06 Feb 2020 15:45:34 -0500 Received: by mail-wm1-x331.google.com with SMTP id t23so337947wmi.1 for ; Thu, 06 Feb 2020 12:45:33 -0800 (PST) In-Reply-To: <871rr86w8p.fsf@ucl.ac.uk> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane-mx.org@gnu.org Sender: "Emacs-orgmode" To: "Fraga, Eric" Cc: Org-mode --000000000000a98314059dee5a5c Content-Type: text/plain; charset="UTF-8" Hi Eric, Great idea! I hadn't considered using the =script= command, it's a great starting point. Thanks! --Diego On Thu, Feb 6, 2020 at 7:55 AM Fraga, Eric wrote: > On Wednesday, 5 Feb 2020 at 18:25, Diego Zamboni wrote: > > 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? > > You haven't said on what type of system but, if Linux, you could try > using =script= as a starting point: > > #+begin_src shell :results output > script < ls > echo 'hello' > EOF > #+end_src > > You may wish to have a second shell script that massages the output in > the =typescript= file and ouputs that instead, e.g. to filter the > carriage returns. > -- > : Eric S Fraga via Emacs 28.0.50, Org release_9.3.2-233-gc2bc48 > --000000000000a98314059dee5a5c Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Eric,

Great idea! I hadn't consi= dered using the =3Dscript=3D command, it's a great starting point.

Thanks!
--Diego

On Thu, = Feb 6, 2020 at 7:55 AM Fraga, Eric <e.fraga@ucl.ac.uk> wrote:
On Wednesday,=C2=A0 5 Feb 2020 at 18:25, Diego Zamboni wr= ote:
> tl;dr: is there a way to have ob-shell (or some similar mode) run comm= ands
> one by one and include the commands, interspersed with their output, i= n the
> #+RESULTS block?

You haven't said on what type of system but, if Linux, you could try using =3Dscript=3D as a starting point:

#+begin_src shell :results output
=C2=A0 script <<EOF
=C2=A0 ls
=C2=A0 echo 'hello'
=C2=A0 EOF
#+end_src

You may wish to have a second shell script that massages the output in
the =3Dtypescript=3D file and ouputs that instead, e.g. to filter the
carriage returns.
--
: Eric S Fraga via Emacs 28.0.50, Org release_9.3.2-233-gc2bc48
--000000000000a98314059dee5a5c--