-   Linux - Newbie (
-   -   another script :) (

Alexander.s 12-14-2004 07:03 AM

another script :)
im sitting here stuck with an ideah but i cant figure out how to do it

i want the script to tell me how much time is left until i have to go to my kungfu practice
and thats 16:20 :D

i want it to say:
You have only 1 hour and fifteen minutes left.
come on!

and it should be accurate to the actual clock ofcourse :)

i did something like
for i in `date`; do
while [ $i -ge 15:30 ] && [ $i -le 16:20 ]; do
echo you have only 50 minutes left! come on!

but i dont think that will work so i need some help.
should i use cut on date? how?


homey 12-14-2004 10:29 AM

Maybe this little diddy will get you started.



hour=`date +%H`
min=`date +%M`
echo "The time is $hour:$min"
    if [ $hour -lt 12 ];then
echo "Good Morning"
    elif [ $hour -ge 12 -a $hour -le 16 ]; then
echo "Good Afternoon"
            if [ $hour -le 16 -a $min -lt $min_max ]; then
            a=$(($hour_max - $hour))
        b=$(($min_max - $min))
        echo "You have $a hours and $b minutes to get to kungfu practice"
        echo "Maybe you can get the next kungfu practice"
echo "Good Night"

All times are GMT -5. The time now is 12:18 PM.