Shell>/dev/null2> & 1

Source: Internet
Author: User
Shell & gt;/dev/null2 & gt; & amp; 1 details shell may often see: & gt;/dev/null2 & gt; & amp; the result of the 1 command can be defined in the form of % & gt;, where % & gt; indicates the file descriptor. We combine this command: & gt;/dev/null2 & gt; & amp; 1 split into four parts for analysis: 1: first... shell ">/dev/null 2> & 1" details shell may often see:> /dev/null 2> & 1 Command results can be defined in the form of %>, where %> represents the file descriptor we will combine this command: ">/dev/null 2> & 1" is split into four parts for analysis: 1: 0> indicates stdin standard input; 1> indicates stdout standard output; 2> indicates stderr error output; 2: Symbol> equivalent to 1> (default value: 1, omitted first ); therefore, ">/dev/null" is equivalent to "1>/dev/nul L "3:/dev/null indicates an empty device file 4: & can be understood as" equivalent ", 2> & 1, that is, the output redirection of 2 is equivalent to 1. Therefore,> /dev/null 2> & 1 can also be written as "1>/dev/null 2> & 1". then the statement execution process in the title of this article is: 1>/dev/null: first, it indicates that the standard output is redirected to an empty device file, that is, no information is output to the terminal. In other words, no information is displayed. 2> & 1: Next, redirect the standard error output to the standard output. because the standard output has been redirected to the empty device file, the standard error output is also redirected to the empty device file.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.