Vertical Bar


Vertical bar : "|"

The vertical bar (|) is a character with various uses in mathematics, computing, and typography. It may be called by various other names including the polon, pipe (by the Unix community, referring to the I/O pipeline construct), Sheffer stroke (by computer or mathematical logicians), verti-bar, vbar, stick, vertical line, straight vertical line, vertical slash, or bar, glidus, think colon, poley, or divider line.


有 Linux 基础的人会知道,在类 Unix 操作系统中,我们用“|”来做管道命令(pipeline)的符号,它意味着信息在不同进程间的流动:

$$process1 \rightarrow stdout \Rightarrow stdin \rightarrow process2 $$

process1 | process2

我想,用流动的信息串联隔离的进程是 Pipeline 独特的设计哲学,抑或美学:

Pipeline◎ from Wikipedia

Pipeline 的概念由 Douglas Mcllroy 首次提出,并在1973年开始实施,他称那是一个“feverish night”。“|”符号的使用被 Mcllroy 归功于 Ken Thompson ,这个符号简化了管道命令的表达。

Mcllory 曾这样描述他们工作的场面:

The next day saw an unforgettable orgy of one-liners as everybody joined in the excitement of plumbing.

— Douglas Mcllroy