[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: redirection to /dev/null

From: Greg Wooledge
Subject: Re: redirection to /dev/null
Date: Thu, 10 Sep 2020 07:50:47 -0400
User-agent: Mutt/1.10.1 (2018-07-13)

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.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]