Created
March 8, 2012 00:51
-
-
Save xtman/1997654 to your computer and use it in GitHub Desktop.
stderr and stdout redirections
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
# redirect stdout to a file | |
cat 1.txt > r.txt | |
# redirect stderr to a file | |
grep "error" 1.log 2> r.txt | |
# redirect stdout to a stderr | |
grep * 1>&2 | |
# redirect stderr to a stdout | |
grep * 2>&1 | |
# redirect stderr and stdout to a file (often used in cron job) | |
grep * &> /dev/null |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment