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.

— symbols.com

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

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

1
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

用“|”这样一个意味着分隔的符号表达进程间的信息传递着实是天才之举。在这样一根竖线背后,信息正悄然串联起一个个隔离的模块,进而串联起你我。

命令沉寂无声,信息涌动成潮。

点击刷新