Developer on Alibaba Coud: Build your first app with APIs, SDKs, and tutorials on the Alibaba Cloud. Read more ＞
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.
This article is an English version of an article which is originally in the Chinese language on aliyun.com and is provided for information purposes only. This website makes no representation or warranty of any kind, either expressed or implied, as to the accuracy, completeness ownership or
reliability of the article or any translations thereof. If you have any concerns or complaints relating to the article, please send an email, providing a detailed description of the concern or
complaint, to firstname.lastname@example.org. A staff member will contact you within 5 working days. Once verified, infringing content will be removed immediately.
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:
and provide relevant evidence. A staff member will contact you within 5 working days.