Alwin, ten eerste bedankt voor je hulp. Echter, dat "kom op zeg" hoeft van mij niet zo. Het suggereerd een beetje dat ik niet wil zoeken of er tijd in wil stoppen. Je moet weten dat ik bijna 0,0 van programmeren en computers af weet. Ga met zo'n gebrek aan kennis maar eens even zoeken naar iets wat je graag gedaan wilt hebben door je computer. Geloof me, dan vind je niet zomaar wat je zoekt. Jij schudt zo even batch+yesterday uit je mouw, maar zulke zoektermen komen in mij niet zomaar op.
Gr.,
Ewald
OK, sorry. Je hebt gelijk. Je had het over Perl, dus om mijn welwillendheid te bewijzen, zie hieronder.
Groeten,
Alwin
#!/usr/bin/perl
################################################
# yesterday.pl
#
# Purpose: There a several times when we need
# a simple way to find out what yesterday's
# date was.
#
# Precon: perl installed.
#
# Postcon: Yesterday's date is returned in the form:
# ddmmyyyy
#
# Mods: date - why - by
# 05/28/04 - initial creation - john blair
#
################################################
# number of seconds in one day
$ONEDAY=86400;
# time returns the number of seconds since epoch
# so we subtract one day from that to get yestderay.
# this populates an array in which pos 3 is the day,
# 4 is the month with 0 = jan and pos 5 is the
# years since 1900.
@YESTERDAY = localtime ( ( time - $ONEDAY ) );
$D = $YESTERDAY[3];
# Normalize the Month
$M = $YESTERDAY[4] + 1;
# Normalize the Year
$Y = $YESTERDAY[5] + 1900;
# we need to pad in a 0 if number is less than 10
# this means we'll need to print them out as strings.
if ( $D < 10 ){
$DAY = "0$D";
}else{
$DAY = $D;
}
if ( $M < 10 ){
$MON = "0$M";
}else{
$MON = $M;
}
printf ( "%s%s%dn", $DAY,$MON,$Y ) ;
##############################################################################
### This script is submitted to BigAdmin by a user of the BigAdmin community.
### Sun Microsystems, Inc. is not responsible for the
### contents or the code enclosed.
###
###
### Copyright 2007 Sun Microsystems, Inc. ALL RIGHTS RESERVED
### Use of this software is authorized pursuant to the
### terms of the license found at
### http://www.sun.com/bigadmin/common/berkeley_license.html
##############################################################################
Quote selectie