month=`date +%m`
day=`date +%d`
year=`date +%Y`
month=`expr $month + 0`
day=`expr $day - 5` # <- changeable
if [ $day -lt 1 ]; then
month=`expr $month - 1`
minusfix=`expr 0 - $day`
#echo $minusfix
if [ $month -eq 0 ]; then
month=12
day=31
year=`expr $year - 1`
else
case $month in
1|3|5|7|8|10|12) day=`expr 31 - $minusfix`;;
4|6|9|11) day=`expr 30 - $minusfix`;;
2)
if [ `expr $year % 4` -eq 0 ]; then
if [ `expr $year % 400` -eq 0 ]; then
day=29
elif [ `expr $year % 100` -eq 0 ]; then
day=28
else
day=29
fi
else
day=28
fi
;;
esac
fi
fi
case $month in
[0-9]) month="0$month";;
esac
case $day in
[0-9]) day="0$day";;
esac
date=$year$month$day
echo "tanggal sekarang `date +%Y%m%d`"
echo "5 hari yg lalu : $date"
Monday, June 18, 2007
get certain date/month on shell script ( 5 dayz in this script )
Related Posts (ajax)
Labels
3g
aaa
Ajax
all leagues
belajar
billing
books
cdma
cdr
cisco
evdo
friends
google
gsm
hspda
hsupa
ims
indonesia
IP
islam
jquery
kpi
leadership
linux
lte
map
mediasi
mml
monitor
moshell
mpls
network
nokia
omc
oracle
oss
paging
parma
performance
perl
players
politics
pstn
radio
script
shell scipt
siemens
signalling
songs
story
switching
telecom
tips
tools
umts
voip
wimax
windows
1 Comment :
Good for people to know.
Post a Comment