redirect inside the $()

$ x=$(date --date="bad" +%s > /dev/null 2>&1)
$ echo $?
1


On Tue, Apr 23, 2019 at 8:05 AM Peter Buck <[email protected]> wrote:

> I have data that I know will contain a few bad dates. I want to
> suppress the error messages.  Redirection isn't working.  Is there
> anything I can do?
>
> coreutils version 8.28-1ubuntu1 on Ubuntu 18.04.2 LTS
>
> $ x=$(date --date="bad" +%s) > /dev/null 2>&1
> date: invalid date ‘bad’
>


-- 
:wq

Reply via email to