是什么在这个bash命令1&GT的符号表示;和2 [英] What does the ampersand indicate in this bash command 1>&2

查看:312
本文介绍了是什么在这个bash命令1&GT的符号表示;和2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

快速之一, 2 - ;&放大器; 1 标准错误重定向到标准输出,但到底是什么的符号是什么意思?我知道,如果我们有 2 - ; 1 它会输出到一个名为 1 ,什么是符号呢?

Quick one, 2>&1 redirects stderr to stdout, but what does the ampersand mean? I know if we had 2 > 1 it would output to a file named 1, what does the ampersand do?

推荐答案

它复制文件描述符1到文件描述符2 FD2是stderr和FD1为stdout,所以它使任何输出到stderr而不是去到stdout。

It copies file descriptor 1 to file descriptor 2. FD2 is stderr and FD1 is stdout, so it makes any output to stderr go to stdout instead.

这篇关于是什么在这个bash命令1&GT的符号表示;和2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆