之前一直没有理解shell中管道操作符和xargs的区别,为什么有一些命令要用可以直接用管道操作符链接,为什么一些需要加个xargs,最近翻了一些文档之后,终于理解
官方定义
最好的解释永远来自于官方文档,正所谓真传一句话,假传万卷书.
管道操作符
A pipeline is a sequence of one or more commands separated by one of the control operators ‘|’ or ‘|&’.
The output of each command in the pipeline is connected via a pipe to the input of the next command. That is, each command reads the previous command’s output. This connection is performed before any redirections specified by command1.
简单来说就是,管道操作符连接一系列命令,前面的标准输出作为后面的标准输入