使用“",“",“"和“"重定向输出的区别是什么?和"2"? [英] What's the difference of redirect an output using ">", "&>", ">&" and "2&>"?

查看:117
本文介绍了使用“",“",“"和“"重定向输出的区别是什么?和"2"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用>&>>&2&>重定向输出有何区别?

What's the difference of redirect an output using >, &>, >& and 2&>?

推荐答案

  • > stdout 重定向到文件
  • 2>&将文件句柄"2"(几乎总是 stderr )重定向到其他文件句柄(通常写为2>&1,它将stderr重定向到与stdout相同的位置). /li>
  • &>>& stdout stderr 都重定向到文件.通常写为&>file(或>&file).在功能上与>file 2>&1相同.
  • 2>将输出重定向到文件句柄2(通常是 stderr )到文件.
    • > redirects stdout to a file
    • 2>& redirects file handle "2" (almost always stderr) to some other file handle (it's generally written as 2>&1, which redirects stderr to the same place as stdout).
    • &> and >& redirect both stdout and stderr to a file. It's normally written as &>file (or >&file). It's functionally the same as >file 2>&1.
    • 2> redirects output to file handle 2 (usually stderr) to a file.
    • 这篇关于使用“",“",“"和“"重定向输出的区别是什么?和"2"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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