In example 1 all output is redirected to /dev/null, because you first redirect /dev/stdout to /dev/null and then redirect /dev/stderr to the device where /dev/stdout is pointing to right now and that's /dev/null (redirections take place from left to right).
In example 2 you redirect /dev/stderr to where /dev/stdout is pointing to at that moment and that's probably your screen. It's important here that both file descriptors are still independent, although they point to the same device. Now you redirect /dev/stdout to /dev/null but /dev/stderr is still pointing to the device where /dev/stdout was pointing to before, and that's still probably your screen.
So example 1 is what you are looking for, because in example 2 error messages are not redirected to /dev/null.
I use the first example myself but came across the second recently and was trying to wrap my head around the why of it all because it looked like the same thing to me.
Now I get it. It took a few reads to let it sink in but it makes sense. The independent file descriptors and left to right assignment is what I misunderstood. I viewed the redirection as a progressive assignment, passing each on to the next in progressive order as opposed to independent assignment from left to right order.
Makes sense. Thanks!
One follow-up question, or confirmation perhaps; would the following entries produce the same expected redirection?
example1: crontab task details here ... >/dev/null example2: crontab task details here ... 2>&1 > /dev/null
Maybe because English isn't my native language... ;)
example1: crontab task details here ... >/dev/null
This will redirect STDOUT to /dev/null but leave STDERR untouched.
example2: crontab task details here ... 2>&1 > /dev/null
This is the same as your first example2, it will redirect STDERR to the device/file where STDOUT is pointing to at the beginning of the cronjob (redirection of STDERR to STDOUT is processed first) and then it will redirect STDOUT to /dev/null (leaving STDERR untouched, or better: STDERR still points to the device/file where STDOUT was pointing to at the beginning of the cronjob).
So under normal circumstances both examples would produce the same redirections: STDOUT writes to /dev/null and STDERR onto the screen (not regarding situations where any of these handles were pointing to e.g. a file).
I hope this wasn't more confusing than my first post...