- Standard input (stdin): code 0, using < or <<;
- Standard output (STDOUT): Code 1, using > or >>;
- Standard wrong Output (stderr): Code 2, using 2> or 2>>;
- 1>: The "Correct information" is added to the specified file or device in a covered manner;
- 1>>: The "Correct information" is added to the specified file or device in a cumulative way;
- 2>: To cover the method of "wrong information" to the designated files or devices;
- 2>>: The "wrong information" is added to the specified file or device in a cumulative way;
According to Bird Brother's information, simple record a few small examples:
Example two: Using General identity account Search/su -dmtsai <==find /home-name. BASHRC <== Identity is Dmtsai Oh! Find:/home/lost+found:permission denied <== standard errorfind:/home/alex: Permission denied <== standard errorfind:/home/arod:permission denied <== Standard error/HOME/DMTSAI/.BASHRC <== standard output
Find 2> List_error
Find 2>/dev/null/HOME/DMTSAI/.BASHRC <== only stdout will be shown on the screen, stderr is discarded
Find 2> List <==find2>&1 <==Find /home-name. BASHRC &> list <== is correct
The first line of the above table is wrong because the two shares are written in a file at the same time, and no special language is used, and the two pieces of information may cross-write into the file, causing the order to go wrong. So although the final list file is still going to be produced, the information in the arrangement will be weird, not the output sort on the original screen. To write the special language of the same file as shown in the table above, you can use the 2>&1 or &>! In general, birds are more accustomed to using 2>&1 's language Method!
Original address: Http://linux.vbird.org/linux_basic/0320bash.php#redirect
Data redirection for Linux