The pipeline takes the previous standard output as the following standard input, and xargs the standard input as the parameter of the command
You can try running the following code:
echo "--help" |cat
echo "--help" |xargs Cat
The results are as follows:
If you enter cat directly on the command line and do not enter a command parameter, then cat waits for standard input, you enter content through the keyboard and press ENTER, and the cat process reads the input and returns it as it is.
So if you enter--help at this point, then the cat program will output on the standard output--help
Other words
- Pipe symbol | What is passed to the program is not the parameters that you simply enter after the program name, and they are received by the program's internal read function such as scanf and get.
- Xargs is to pass the content as a normal parameter to the program, in this case the equivalent of you hand-written cat--help, the system will output the cat's Help document
From: http://forum.ubuntu.org.cn/viewtopic.php?t=354669
The difference between Xargs and pipelines under Linux