Shell 2> & 1

Source: Internet
Author: User

I have never been familiar with Shell and used to write command> log. log 2> & 1 when reporting error logs.
Today, a colleague read my shell script and asked me what I meant by 2> & 1, which really gave me a hard time.
After Google, I have a rough understanding:
 
The default standard shell input is the keyboard, or you can try files or pipelines |
By default, the standard output can be a terminal, a file, or a media transcoding queue.
Standard errors are also terminal errors by default. You can try files.
 
Standard input, output, and error output indicate stdin stdout stderr, respectively, or 0 1 2.
 
With the above explanation, you will understand
 
Make-J8> make. log. $2> & 1
 
2> indicates the redirection of the standard output.
 
& Is equivalent
 
2> & 1 indicates that the standard error output is equivalent to the standard output.
 
Make-J8> make. log. $2> & 1, that is, both the standard output and the standard error output are input to the make. log.3850 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.