On Thu, Sep 10, 2020 at 09:16:03AM +0900, Koichi Murase wrote:
> > I've also read that '&> /dev/null' is outdated and should be replaced
> > with '>/dev/null 2>&1'
> >
> > True? And exactly why?
>
> I'm also interested in whether it is really outdated and should not be
> used.
"Outdated" is not the word I'd use to describe it. It's an extension
beyond POSIX, so it's simply not supported in regular /bin/sh shells.
Since the commands inside a crontab are generally interpreted by
a /bin/sh shell, you can't use it there -- at least, not on most systems.
As Eli says, it doesn't really offer any significant advantages over
the standard POSIX syntax. The main one is not having to remember that
the 2>&1 goes at the END -- I have a whole FAQ page on that -- but
that just enables people to continue being ignorant. And the flip side
is that you have to remember whether it's >&/dev/null or &>/dev/null.
I never use &> at all.