emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* How do I diff the outputs of two blocks in org-babel?
@ 2020-03-05  5:07 Vladimir Nikishkin
  0 siblings, 0 replies; only message in thread
From: Vladimir Nikishkin @ 2020-03-05  5:07 UTC (permalink / raw)
  To: emacs-orgmode

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-03-05  5:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-05  5:07 How do I diff the outputs of two blocks in org-babel? Vladimir Nikishkin

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).