shellme
05-27-2005, 01:42 PM
This script i worte doesnt work right..
it is supposed to tell how many days till a certain date.. when you type in a date 2 days from now it says 2.. but if you say 2 days before it say 2 also... it doesnt say 363 days! please help here is the script i wrote..
#!/bin/bash
echo "Enter your birthday as Month Day, i.e. May 19"
read birthday
now=`date +%d`
birthdayday=`date -d "$birthday" +%d`
if [ "$birthdayday" -gt "$now" ]; then
let numofday=$birthdaysec-$now
else
let numofday=$now-$birthdayday
fi
echo "Number of days until your birthday: $numofday"
exit 0
please make this work right!!
it is supposed to tell how many days till a certain date.. when you type in a date 2 days from now it says 2.. but if you say 2 days before it say 2 also... it doesnt say 363 days! please help here is the script i wrote..
#!/bin/bash
echo "Enter your birthday as Month Day, i.e. May 19"
read birthday
now=`date +%d`
birthdayday=`date -d "$birthday" +%d`
if [ "$birthdayday" -gt "$now" ]; then
let numofday=$birthdaysec-$now
else
let numofday=$now-$birthdayday
fi
echo "Number of days until your birthday: $numofday"
exit 0
please make this work right!!