我经常使用的bash管道,例如:
I often use pipes in BASH, e.g.:
dmesg | less虽然我知道这是什么输出,需要的dmesg ,让我通过它滚动与少,我做的不明白什么 | 在做什么。难道仅仅&GT相反;
Although I know what this outputs, it takes dmesg and lets me scroll through it with less, I do not understand what the | is doing. Is it simply the opposite of >?
- 是否有一个简单的,或隐喻解释是什么 | 确实
- 当几个管道在一行上使用善有善报?
- 是无处不在它出现在一个bash脚本管一致的行为?
UNIX管道连接STDOUT(标准输出)的第一道工序到第二的STDIN(标准输入)的文件描述符。会发生什么然后是,当第一个进程写入其STDOUT,该输出可以立即(从STDIN)由第二过程读出。
A Unix pipe connects the STDOUT (standard output) file descriptor of the first process to the STDIN (standard input) of the second. What happens then is that when the first process writes to its STDOUT, that output can be immediately read (from STDIN) by the second process.
使用多个管道没有比使用单管不同。每根管子是独立的,并简单地连接相邻进程的STDOUT和STDIN。
Using multiple pipes is no different than using a single pipe. Each pipe is independent, and simply links the STDOUT and STDIN of the adjacent processes.
您的第三个问题是有点含糊不清。是的,管道,因为这样,到处都是一致的bash脚本。然而,管道符 | 可以重新present不同的事情。双管( || ),再presents的或运算符,例如
Your third question is a little bit ambiguous. Yes, pipes, as such, are consistent everywhere in a bash script. However, the pipe character | can represent different things. Double pipe (||), represents the "or" operator, for example.
更多推荐
什么是管道中的BASH是如何工作的一个简单的解释?
发布评论