emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Vladimir Nikishkin <lockywolf@gmail.com>
To: emacs-orgmode@gnu.org
Subject: How do I diff the outputs of two blocks in org-babel?
Date: Thu, 5 Mar 2020 13:07:43 +0800	[thread overview]
Message-ID: <CA+A2iZbqBSB0Ac0qfQm0QOZGpGpkxanCmZr5HCprspBwu4Ermg@mail.gmail.com> (raw)

Support I have two blocks:

#+name: block1
#+begin_src shell
    cat <<'ADDTEXT4'
    #!/bin/bash
    echo "This script creates a new file"
    var1=10
    var3=50
    ((result=$var1*$var2))
    echo "The result = $result"
ADDTEXT4
#+end_src

#+name: block2
#+begin_src shell
    cat <<'ADDTEXT4'
    #!/bin/bash
    echo "This script creates a new file"
    var1=10
    var2=50
    ((result=$var1*$var2))
    echo "The result = $result"
ADDTEXT4
#+end_src

The first one has a bug in it.

At the moment I am diffing them like this:

#+begin_src shell :results output code :wrap src patch
  output1=$(
  cat <<EOF
  <<block1()>>
  EOF
  )

  output2=$(
  cat <<EOF
  <<block2()>>
  EOF
  )
  diff -s -u <(echo "$output1") <(echo "$output2")
#+end_src

But this looks a bit too complicated.

Any better solution?

-- 
Yours sincerely, Vladimir Nikishkin

                 reply	other threads:[~2020-03-05  5:07 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CA+A2iZbqBSB0Ac0qfQm0QOZGpGpkxanCmZr5HCprspBwu4Ermg@mail.gmail.com \
    --to=lockywolf@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).