且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

壳牌程序管道C

更新时间:2023-02-08 19:36:38

我可能误解了这个问题,但是您的程序永远不会参见管道字符|.

I may have misunderstood the question, but your program won't ever see the pipe character, |.

shell处理整个命令行,可以这么说,您的程序只会获得其在命令行中的份额.

The shell processes the entire command line, and your program will only be given it's share of the command line, so to speak.

示例:

cat file1 file2 | sed s/frog/bat/

在上面的示例中,仅使用两个参数file1file2调用cat.另外,sed仅用一个参数调用:s/frog/bat/.

In the above example, cat is invoked with only two arguments, file1, and file2. Also, sed is invoked with only a single argument: s/frog/bat/.