一般在bash中皂吮,用“|”作為管道,即pipeline税手,還可以用“;”之類的分隔符連接多個命令蜂筹。那么下面這個命令的輸出是什么呢?
date; who |wc
根據(jù)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"結(jié)合