[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [TEKNIK] Busybox - date / awk ?



On Fri, 27 Apr 2007 13:02:32 +0200
"Brian Ipsen" <sslug@sslug> wrote:

> Hej.
> 
>  Jeg har en linux-baseret boks (som vist kører noget busybox), hvor
> jeg skal have gravet gårsdgaens dato frem på..
> 
> date kommando'en er ret begrænset i forhold til den "normale" i
> linux, men jeg har gravet lidt, og fundet frem til, at følgende måske
> kan hjælpe mig:
> 
> Linux timestamp'et kan jeg få ud med:
> 
> #date +%s
> 1177670573
> 
> Ok, skal jeg et døgn tilbage, så skal jeg jo trække 86400 sekunder
> fra..  Da boksen ikke har perl eller bash, så må jeg bruge awk til
> matematik...
> 
> Følgende fungerer:
> 
> awk 'BEGIN { print strftime("%d-%m-%y", 1177670573-86400); exit }'
> 
> Problemet er bare, at timestamp'et er en variabel... Jeg har prøvet 
> følgende, men det fungerer ikke:
> 
> CURRDATE=`date +%s`
> echo $CURRDATE | awk 'BEGIN { print strftime("%d-%m-%y", $1-86400);
> exit }'
> 
> Hvad skal der til, for at jeg kan få awk til at regne rigtigt ??
> 

En ting er at bruge awk - men er det nødvendigt?

hvad med f.eks.

   date -d 'now-1 day' +%d-%m-%y

Mvh
  Jesper K. Pedersen


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2007-05-01, 02:01 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *