Afficher un message
Vieux 12/09/2007, 06h08   #8
Cyrus Kriticos
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Script to compare dates and notify


Janis Papanagnou wrote:
> Cyrus Kriticos wrote:
>>
>> $ NOW=$(date -d $(date +'%Y-%m-%d') +'%s')

>
> $ NOW=$(date -d $(date +'%Y-%m-%d') +'%s') ; echo $NOW
> 1189552546
>
> $ NOW=$(date +'%s') ; echo $NOW
> 1189552546
>
> You're thinking too complex, I suppose. :-)
> (Or any trick I am missing?)


# seconds since 1970-01-01 to midnight
$ NOW=$(date -d $(date +'%Y-%m-%d') +'%s') ; echo $NOW
1189548000

# seconds since 1970-01-01 to now
$ NOW=$(date +'%s') ; echo $NOW
1189569887

$ date --version | head -n 1
date (GNU coreutils) 5.97

--
Best regards | "The only way to really learn scripting is to write
Cyrus | scripts." -- Advanced Bash-Scripting Guide
  Réponse avec citation
 
Page generated in 0,21901 seconds with 9 queries