本文主要是介绍管道命令和xargs的区别,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
- 管道命令和xargs的区别
- 效果展示
管道命令和xargs的区别
- 管道命令,是把管道前面命令的输出结果,作为管道后面命令的“输入”。
个人理解,就当是把管道前面命令的输出结果,加上双引号,以字符串的形式,传递给管道后面命令。
如下命令,最终执行的是cat "--help"
。
echo "--help" | cat
- xargs, 是把管道前面命令的输出结果,作为管道后面命令的“参数”。
如下命令,最终执行的是cat --help
。
echo "--help" | xargs cat
效果展示
qilei@AFAAW-704030720:~$ echo "--help" | cat
--help
qilei@AFAAW-704030720:~$ echo "--help" | xargs cat
Usage: cat [OPTION]... [FILE]...
Concatenate FILE(s), or standard input, to standard output.-A, --show-all equivalent to -vET-b, --number-nonblank number nonempty output lines, overrides -n-e equivalent to -vE-E, --show-ends display $ at end of each line-n, --number number all output lines-s, --squeeze-blank suppress repeated empty output lines-t equivalent to -vT-T, --show-tabs display TAB characters as ^I-u (ignored)-v, --show-nonprinting use ^ and M- notation, except for LFD and TAB--help display this help and exit--version output version information and exitWith no FILE, or when FILE is -, read standard input.Examples:cat f - g Output f's contents, then standard input, then g's contents.cat Copy standard input to standard output.Report cat bugs to bug-coreutils@gnu.org
GNU coreutils home page: <http://www.gnu.org/software/coreutils/>
General help using GNU software: <http://www.gnu.org/gethelp/>
For complete documentation, run: info coreutils 'cat invocation'
qilei@AFAAW-704030720:~$
这篇关于管道命令和xargs的区别的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!