Skip to content

Files

Latest commit

 

History

History
27 lines (16 loc) · 651 Bytes

SC2069.md

File metadata and controls

27 lines (16 loc) · 651 Bytes

Pattern: Incorrect order for 2>&1 and redirect

Issue: -

Description

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)".

Further Reading