Monday, March 11, 2024

redirect stderr and stdout

While researching various methods to implement a reminder to take a break - some notes about redirecting stderr and stdout - 

ls good bad >/dev/null 2>&1

You have to redirect stdout first before duplicating it into stderr; if you duplicate it first, stderr will just point to what stdout originally pointed at.

No comments:

Post a Comment