Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 12-14-2004, 07:03 AM   #1
Registered: Sep 2004
Location: Sweden
Distribution: Slackware, Gentoo!
Posts: 115

Rep: Reputation: 15
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

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?

Old 12-14-2004, 10:29 AM   #2
Senior Member
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 59
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"


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Iptables (with masq) troubleshooting, very simple script attached script and logs. xinu Linux - Networking 13 11-01-2007 05:19 AM
Directory listing - Calling shell script from a CGI script seran Programming 6 08-12-2005 12:08 AM
creating shell script that executes as root regardless of who runs the script? m3kgt Linux - General 13 06-04-2004 11:23 PM
send automatic input to a script called by another script in bash programming jorgecab Programming 2 04-01-2004 01:20 AM
linux 9 and java script error - premature end of script header sibil Linux - Newbie 0 01-06-2004 05:21 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:20 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration