【发布时间】:2016-05-24 22:11:43
【问题描述】:
例如
echo "aaa" |& cat
|& 在这里是什么意思?
有推荐的网站来查找这些吗?由于大多数搜索引擎不支持搜索特殊字符。
【问题讨论】:
标签: bash
例如
echo "aaa" |& cat
|& 在这里是什么意思?
有推荐的网站来查找这些吗?由于大多数搜索引擎不支持搜索特殊字符。
【问题讨论】:
标签: bash
来自man 1 bash,管道部分:
[时间 [-p]] [ ! ] 命令 [ [|⎪|&] 命令2 ... ]
如果使用|&,
command的标准错误,除了它的标准输出,通过管道连接到command2的标准输入
所以它就像管道运算符|,但同时管道standard output 和standard error。
【讨论】:
If ‘|&’ is used, command1’s standard error, in addition to its standard output, is connected to command2’s standard input through the pipe; it is shorthand for 2>&1 |.
此操作符将标准输出和标准错误从左侧传送到右侧。
Bash reference manual 具有所有运算符的综合索引,您可以在其中查找这些运算符。
【讨论】:
如果使用'|&',command1的标准错误,除了它的标准输出,通过管道连接到command2的标准输入;它是 2>&1 | 的简写。标准错误到标准输出的这种隐式重定向是在命令指定的任何重定向之后执行的。
【讨论】: