Pattern: Incorrect order for 2>&1
and redirect
Issue: -
Redirections are handled in order. If you want stderr as stdout and stdout to a file, you can ignore this warning.
Example of incorrect code:
firefox 2>&1 > /dev/null
This means "Point stderr to where stdout is currently pointing (the terminal). Then point stdout to /dev/null
".
Example of correct code:
firefox 2>&1 > /dev/null
This means "Point stdout to /dev/null
. Then point stderr to where stdout is currently pointing (/dev/null
)".