操作系统:HP-UX
#!/bin/ksh
DATE1=$(date +%Y%m%d)
mkdir /opt/r3/$DATE1
dd=$(date +%d)
mm=$(date +%m)
yy=$(date +%Y)
while :
do
[ $dd = "01" -a $mm = "01" ] && /
{
yesterday=$((yy-1))1231
tomorrow=${yy}0102
break
}
[ $dd = "31" -a $mm = "12" ] && /
{
yesterday=${yy}1230
tomorrow=$((yy+1))0101
break
}
[ $dd = "01" ] && /
{
yesterday=${yy}$((mm-1))$(cal $((mm-1)) $yy |xargs|awk '{print $NF}')
tomorrow=${yy}${mm}02
break
}
[ $dd = "$(cal $mm $yy |xargs|awk '{print $NF}')" ] && /
{
yesterday=${yy}${mm}$((dd-1))
tomorrow=${yy}$((mm+1))01
break
}
export yesterday=${yy}${mm}$(printf "%02d" $((dd-1)))
rm -rf /opt/r3/$yesterday
tomorrow=${yy}${mm}$(printf "%02d" $((dd+1)))
#mkdir /tmp/$tomorrow
break
done
# echo " yesterday = $yesterday/n tomorrow = $tomorrow"[/quote]
操作系统:Linux
DATE=$(date +%Y%m%d%T)