Capture output from a shell command with babel in org-mode
Asked Answered
A

1

12

I want to know about my networking hardware.

lspci | grep -i net

From the terminal, this command gives the following output:

00:19.0 Ethernet controller: Intel Corporation 82577LM Gigabit Network Connection (rev 06) 02:00.0 Network controller: Intel Corporation Centrino Advanced-N 6200 (rev 35)

But when I try running this from org-mode through a babel source block I get no output.

#+BEGIN_SRC sh
lspci | grep -i net
#+END_SRC

#+RESULTS:

What gives? How can I get the same output I got from the terminal?

Azotize answered 7/10, 2012 at 18:37 Comment(0)
C
16

You do get results, only not handled properly (most likely temporarily displayed in the minibuffer).

Add :results output replace after #+begin_src sh, as a header argument (to override default values), to have the output (re)placed in your org-mode buffer. All its possible values are described here in the Manual.

Converge answered 7/10, 2012 at 18:54 Comment(2)
Adding :results replace was the first thing I tried. Unfornately, I didn't see any change in output. Reading the manual I saw that :results replace was the default value anyway.Azotize
@wdkrnls: try results: output replace, and results: append, maybe also. Check they're not output elsewhere in the buffer, if you have a #+name (by executing in a blank org file). (also the mistake I usually do is to forget the plural to resultS)Converge

© 2022 - 2024 — McMap. All rights reserved.