coreutils
[Top][All Lists]
Advanced

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

Re: suppress date() error messages?


From: Peter Buck
Subject: Re: suppress date() error messages?
Date: Tue, 23 Apr 2019 17:12:18 -0400

Thanks, Steeve.  A brilliant solution I would never have thought
of....but which makes perfect sense now that I've seen it.
I spent some time today developing a regex to pre-test the dates, but
your solution is way more elegant. - Peter
-----Original Message-----From: Steeve McCauley <
address@hidden>To: Peter Buck <address@hidden>Cc: 
coreutils@gnu.orgSubject: Re: suppress date() error messages?Date: Tue,
23 Apr 2019 08:38:37 -0500
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 <address@hidden> 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’
> 




reply via email to

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