对调shell的标准输出与标准错误输出
时间:2014-09-10 21:42 来源:linux.it.net.cn 作者:it
将标准输出与标准错误输出的文件描述符路径调换的例子,有需要的朋友不妨参考下。
复制代码代码如下:
[root@station ~]# adfasdf | cat
-bash: adfasdf: command not found
[root@station ~]# adfasdf | cat > 123.txt
-bash: adfasdf: command not found
[root@station ~]# cat 123.txt
[root@station ~]# adfasdf 3>&1 1>&2 2>&3- | cat > 123.txt
[root@station ~]# cat 123.txt
-bash: adfasdf: command not found
(责任编辑:IT)
将标准输出与标准错误输出的文件描述符路径调换的例子,有需要的朋友不妨参考下。
复制代码代码如下:
[root@station ~]# adfasdf | cat
(责任编辑:IT)-bash: adfasdf: command not found [root@station ~]# adfasdf | cat > 123.txt -bash: adfasdf: command not found [root@station ~]# cat 123.txt [root@station ~]# adfasdf 3>&1 1>&2 2>&3- | cat > 123.txt [root@station ~]# cat 123.txt -bash: adfasdf: command not found |