emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How do I diff the outputs of two blocks in org-babel?


From: Vladimir Nikishkin
Subject: How do I diff the outputs of two blocks in org-babel?
Date: Thu, 5 Mar 2020 13:07:43 +0800

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 via email to

[Prev in Thread] Current Thread [Next in Thread]