Redirection comment in Shell

Source: Internet
Author: User

00 00 1 ** echo "">/usr/local/Apache/logs/error_log>/dev/null 2> & 1
>/Dev/null redirects the output to/dev/null, which is an empty device, that is, ignoring its output.
2> & 1 refers to outputting errors to the standard output. If debugging is performed on the console, that is, on the screen, debugging is convenient.
There are three default I/O values. 0 indicates the standard input, generally the keyboard, 1 indicates the standard output, and generally the screen. 2 indicates the standard error.

----------------------------------------------------------------------

1>/dev/null 2> & 1 meaning

Shell may often see:>/dev/null 2> & 1

Command results can be defined in the form of %>

/Dev/null indicates an empty device file.
> Indicates the redirection location, for example, Echo "321">/tmp/321.txt
1 indicates stdout standard output. The default value is 1, so ">/dev/null" is equivalent to "1>/dev/null"
2 indicates stderr standard error
& Indicates equivalent meaning, 2> & 1, indicating that 2 output redirection is equivalent to 1

The statement in the title of this article:
1>/dev/null 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, the standard error output redirection is equivalent 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.