no save
Assistance
Achat
News

Forum | Linux/Unix
Commande unix - date de la veille
Jeff, le ven. 29 août 2003 à 00:27:04
ou en ksh :


--- cut here for tz.sh ---
#!/bin/ksh
# Usage tz.sh N [fmt_string]
# Where N is how many days to go backward
# fmt_string is optional format arg to date command

days=$1;shift

date "+%H %Z" | read t1 tn
t0=$(TZ=0 date +%H)
(( delta = t0 - t1 ))
(( adjust = delta + 24 * days ))

TZ="$tn$adjust" date "$@"

--- end of tz.sh ---

tz.sh 1 # gives you the date and time 24 hours ago
tz.sh 1 '+%d' # gives you just yesterday's day of the month
tz.sh 1 '+%Y%m%d' # gives you yesterday as yyyymmdd
tz.sh -1 # gives you tomorrow


source : comp.unix.aix : http://groups.google.fr/groups?hl=fr&lr=&ie=UTF-8&oe=UTF-8&threadm=d1c185ef.0201230015.4078df0%40posting.google.com&rnum=7&prev=/&frame=on

PrécédentJeff
août 03
defre
août 03
Suivant
REPONSES
Jeff
août 03
Jeff
août 03
Jeff
août 03
defre
août 03
Jeff
août 03
defre
août 03
Jeff
août 03
Jeff
août 03
defre
août 03
francoispgp
août 03
Version Web
Réalisé par RedShift
no save