On Sun, 17 Apr 2016, at 12:46, Thomas Schmitt wrote: > Jeremy Nicoll wrote: > > Why is the "2>&1" part needed? Wouldn't stderr go to the terminal by > > default. > > Goal is to redirect both to /dev/null. > > So these would do: > > bin/mailwatcher 2>/dev/null >/dev/null & > > bin/mailwatcher >/dev/null 2>&1 &
Yes, I understand that. > But as Michael Milliman pointed out, > > bin/mailwatcher 2>&1 >/dev/null & > > redirects only stdout to /dev/null and leaves stderr directed to where > stdout was pointing before. And I understand that too. But I was asking from a different perspective. What I meant was, if someone is trying to redirect stdout to /dev/null and leave stderr directed to the terminal (which seems to be the default), would anyone ever code: bin/mailwatcher 2>&1 >/dev/null when surely all they need is bin/mailwatcher >/dev/null -- Jeremy Nicoll - my opinions are my own.