Shopping In MUMBAI

Are you searching for Discounts, offers, sale in Mumbai ? You are in the right place. MUMBAI, a shopping haven, has no dearth of great discounts and sales. This blog features the best MUMBAI shopping offers, sale, discounts and deals and bargains CURRENTLY GOING on in Mumbai plus a few free things thrown in on top. Don't wait for it because once they are gone, they are gone. Hurry!..By clicking the "Like" button you will receive a daily update of discounts, sale, offers going on in Mumbai. LIKE IT.... SHARE IT...njoY.

Friday, February 13, 2009

Program in UNIX to validate the date

Write a shell script to validate the date

echo "Enter date (dd-mm-yyyy) :"
read da
IFS="-"
n="[0-9][0-9]"
month=(0 31 29 31 30 31 30 31 3 30 31 30 31)

case $da in
" ") echo "Date not entered ";;
$n-$n-$n$n) set $da

if [ `expr $3 % 4` -eq 0 -a \( `expr $3 % 400` -eq 0 -o `expr $3 % 100` -ne 0 \) ]
then
leap=1
else
leap=0
fi
if [ $2 -gt 12 -o $2 -eq 0 ]
then
echo "invalid month"
exit
else
case $da in
29-02-????)
if [ $leap -eq 1 ]
then
break
else
echo "Invalid date"
exit
fi ;;
*)
if [ $1 -gt ${month[$2]} -o $1 -eq 0 ]
then
echo invalid day
exit
fi ;;
esac
fi;;
*) echo "invalid date"
exit
esac
echo “$1-$2-$3 is a valid date”

Program in UNIX to validate the dateSocialTwist Tell-a-Friend

0 comments:

SUPPORT THIS BLOG