简体   繁体   English

在 org-mode 中使用 babel 从 shell 命令捕获输出

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

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) 00:19.0 以太网控制器:英特尔公司 82577LM 千兆网络连接(修订版 06) 02:00.0 网络控制器:英特尔公司 Centrino Advanced-N 6200(修订版 35)

But when I try running this from org-mode through a babel source block I get no output.但是当我尝试通过 babel 源代码块从 org-mode 运行它时,我没有得到任何输出。

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

#+RESULTS:

What gives?是什么赋予了? How can I get the same output I got from the terminal?如何获得从终端获得的相同输出?

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.#+begin_src sh之后添加:results output replace作为标头参数(覆盖默认值),将输出(重新)放置在您的组织模式缓冲区中。 All its possible values are described here in the Manual .它的所有可能值都在手册中描述。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM