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

∥☆過路亽.° 提交于 2019-12-06 20:53:37

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/12771642/capture-output-from-a-shell-command-with-babel-in-org-mode

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!