一般在bash中,用“|”作为管道,即pipeline,还可以用“;”之类的分隔符连接多个命令。那么下面这个命令的输出是什么呢?
date; who |wc
根据https://www.gnu.org/software/bash/manual/bashref.html里的说明,管道是’|’或者’|&’分隔的命令
A pipeline is a sequence of one or more commands separated by one of the control operators ‘|’ or ‘|&’
而list是‘;’, ‘&’, ‘&&’或者 ‘||’分隔的管道
A list is a sequence of one or more pipelines separated by one of the operators ‘;’, ‘&’, ‘&&’, or ‘||’, and optionally terminated by one of ‘;’, ‘&’, or a newline.Of these list operators, ‘&&’ and ‘||’ have equal precedence, followed by ‘;’ and ‘&’, which have equal precedence.
因此上面的命令中,”who | wc”作为一个管道,再和前面的”date”结合