help-bash
[Top][All Lists]
Advanced

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

Re: Redirect to /dev/null


From: David
Subject: Re: Redirect to /dev/null
Date: Thu, 10 Sep 2020 15:37:48 +1000

On Thu, 10 Sep 2020 at 09:04, Chris Elvidge <celvidge001@gmail.com> wrote:
>
> I've recently come across a crontab line:
> 0 */6 * * *     /usr/bin/modprobed-db store &> /dev/null
>
> I've also read that '&> /dev/null' is outdated and should be replaced
> with '>/dev/null 2>&1'
>
> True? And exactly why?

True because although bash accepts &> and >& as valid
redirection-operator syntax, that syntax is not recognised
by all other shells and will instead give unexpected results
if used in those shells. So if your cron is not using bash,
problems might occur.

The POSIX standard redirection operators are described here:
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_07

More information:
http://mywiki.wooledge.org/BashGuide/InputAndOutput#Redirection
http://mywiki.wooledge.org/BashFAQ/055



reply via email to

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