Created
May 2, 2017 03:16
-
-
Save wfxr/c07859186fa310a33302cdc9b5a254e5 to your computer and use it in GitHub Desktop.
Linux重定向命令介绍
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| see: https://unix.stackexchange.com/a/70971 | |
| 2>&- | |
| The general form of this one is M>&-, where "M" is a file descriptor number. This will close output for whichever file descriptor is referenced, i.e. "M". | |
| 2>/dev/null | |
| The general form of this one is M>/dev/null, where "M" is a file descriptor number. This will redirect the file descriptor, "M", to /dev/null. | |
| 2>&1 | |
| The general form of this one is M>&N, where "M" & "N" are file descriptor numbers. It combines the output of file descriptors "M" and "N" into a single stream. | |
| |& | |
| This is just an abbreviation for 2>&1 |. It was added in Bash 4. | |
| &>/dev/null | |
| This is just an abbreviation for >/dev/null 2>&1. It redirects file descriptor 2 (STDERR) and descriptor 1 (STDOUT) to /dev/null. | |
| >/dev/null | |
| This is just an abbreviation for 1>/dev/null. It redirects file descriptor 1 (STDOUT) to /dev/null. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment