Updated SC2069 (markdown)

koalaman
2014-11-20 12:14:13 -08:00
parent dcbc7aa531
commit 5ec5f4a8a7

@@ -1 +1,21 @@
The order of the 2>&1 and the redirect matters. The 2>&1 has to be last. ## The order of the 2>&1 and the redirect matters. The 2>&1 has to be last.
### Problematic code:
firefox 2>&1 > /dev/null
### Correct code:
firefox > /dev/null 2>&1
### Rationale:
Redirections are handled in order.
The problematic code means "Point stderr to where stdout is currently pointing (the terminal). Then point stdout to /dev/null".
The correct code means "Point stdout to /dev/null. Then point stderr to where stdout is currently pointing (/dev/null).".
### Contraindications
If you want stderr as stdout and stdout to a file, you can ignore this message.