emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* No output from babel shell src block
@ 2016-05-12 19:24 John Hendy
  2016-05-12 19:36 ` Ken Mankoff
  2016-05-12 20:10 ` Thomas S. Dye
  0 siblings, 2 replies; 3+ messages in thread
From: John Hendy @ 2016-05-12 19:24 UTC (permalink / raw)
  To: emacs-orgmode

Hello,


I've not used shell in babel much, and am confused. I was trying to
include diff output from a block in an analysis and it's not giving
any output.

As a test, I have a.txt which contains 1 and b.txt which contains 2,
with boths in ~/Desktop.

Manually:
$ cd ~/Desktop
$ diff a.txt b.txt
1c1
< 1
---
> 2

Org:
#+begin_src shell

cd ~/Desktop
diff a.txt b.txt

#+end_src

I get "Code block produced no output" with C-c C-c. If I replace the
diff line with =pwd=, it puts the current directory in the results
block (works as expected).

I've tried replace, append, output, raw, and value for :results, as
well as results and both for :exports. I've also tried using a #+name:
which gives me a results block for the output, but it's empty.

Am I missing something? Perhaps there's an analog for how some
programs need a print() of some kind for the results to show up? Then
again, I don't know why =pwd= works... There's no worg page for the
shell language (surprised me!).


Thanks,
John

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: No output from babel shell src block
  2016-05-12 19:24 No output from babel shell src block John Hendy
@ 2016-05-12 19:36 ` Ken Mankoff
  2016-05-12 20:10 ` Thomas S. Dye
  1 sibling, 0 replies; 3+ messages in thread
From: Ken Mankoff @ 2016-05-12 19:36 UTC (permalink / raw)
  To: John Hendy; +Cc: emacs-orgmode


This is a known issue with diff, I think. Add a line containing ":" below, or "echo" or "diff foo bar | cat".

https://stackoverflow.com/questions/27304469/capturing-the-output-of-diff-with-org-babel

I have

(setq org-babel-default-header-args:sh
  '((:prologue . "exec 2>&1") (:epilogue . ":"))
)

so that stderr is always displayed in the RESULTS block.

  -k.
  
On 2016-05-12 at 15:24, John Hendy <jw.hendy@gmail.com> wrote:
> Hello,
>
>
> I've not used shell in babel much, and am confused. I was trying to
> include diff output from a block in an analysis and it's not giving
> any output.
>
> As a test, I have a.txt which contains 1 and b.txt which contains 2,
> with boths in ~/Desktop.
>
> Manually:
> $ cd ~/Desktop
> $ diff a.txt b.txt
> 1c1
> < 1
> ---
>> 2
>
> Org:
> #+begin_src shell
>
> cd ~/Desktop
> diff a.txt b.txt
>
> #+end_src
>
> I get "Code block produced no output" with C-c C-c. If I replace the
> diff line with =pwd=, it puts the current directory in the results
> block (works as expected).
>
> I've tried replace, append, output, raw, and value for :results, as
> well as results and both for :exports. I've also tried using a #+name:
> which gives me a results block for the output, but it's empty.
>
> Am I missing something? Perhaps there's an analog for how some
> programs need a print() of some kind for the results to show up? Then
> again, I don't know why =pwd= works... There's no worg page for the
> shell language (surprised me!).
>
>
> Thanks,
> John

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: No output from babel shell src block
  2016-05-12 19:24 No output from babel shell src block John Hendy
  2016-05-12 19:36 ` Ken Mankoff
@ 2016-05-12 20:10 ` Thomas S. Dye
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas S. Dye @ 2016-05-12 20:10 UTC (permalink / raw)
  To: John Hendy; +Cc: emacs-orgmode


John Hendy writes:

> There's no worg page for the shell language (surprised me!).

Several babel languages in core lack documentation on Worg in addition
to shell: calc, comint, coq, ebnf, emacs-lisp(!), forth, fortran,
haskell, io, java, javascript, objective caml, org(!!!), perl, plantuml,
processing, ruby, sass, scala, scheme, sed, and shen.

You've already contributed to the documentation effort (thanks!), but
potential volunteers might visit here for a documentation template:
http://orgmode.org/worg/org-contrib/babel/languages.html#develop

It's not such a big job to write the babel documentation, but it
certainly helps to understand the language being documented :-)

All the best,
Tom

-- 
Thomas S. Dye
http://www.tsdye.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-05-12 20:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-12 19:24 No output from babel shell src block John Hendy
2016-05-12 19:36 ` Ken Mankoff
2016-05-12 20:10 ` Thomas S. Dye

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