“|"是什么意思?在终端命令行中是什么意思? [英] What does "|" mean in a terminal command line?
问题描述
很抱歉在这里发布它,但 Google 在搜索符号时做得很糟糕.
|"是什么意思意思是:
一些字符串" |一些可执行文件
是管道符号.它在命令行上分隔两个程序(参见 Pipelines
bash
手册中),第一个程序的标准输出(在管道的左侧)连接到第二个程序的标准输入(在管道的右侧).>
例如:
谁 |wc -l
为您提供连接到您的计算机的人数或会话数(加上来自 who
的标题行的 1).打折标题行:
谁 |sed 1d |wc -l
sed
的输入来自who
,sed
的输出到wc
.>
底层系统调用是pipe(2)
使用结合 fork()
, dup2()
和 exec*()
系统调用.
Sorry for posting it here, but Google does a very bad job when searching for symbols.
What does the "|" mean in:
"some string" | someexecutable.py
It is the pipe symbol. It separates two programs on a command line (see Pipelines
in the bash
manual), and the standard output of the first program (on the LHS of the pipe) is connected to the standard input of the second program (on the RHS of the pipe).
For example:
who | wc -l
gives you a count of the number of people or sessions connected to your computer (plus one for the header line from who
). To discount the header line:
who | sed 1d | wc -l
The input to sed
comes from who
, and the output of sed
goes to wc
.
The underlying system call is pipe(2)
used in conjunction with fork()
, dup2()
and the exec*()
system calls.
这篇关于“|"是什么意思?在终端命令行中是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!