Using output of previous commands in bash

后端 未结 5 2146
情书的邮戳
情书的邮戳 2021-02-20 00:50

In Mathematica, it is possible to reuse the output of the previous command by using %.

Is something similar possible for bash (or some other shell)?

For example,

5条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-20 01:31

    I'm not sure if the make command sends warnings to stderr but I suspect it does. try this

    make 2&>1 |grep 'warning'
    

    it will redirect stderr to stdout.

    Should also note that you can't grep anything that's not going to stdout.

提交回复
热议问题