How would you write a program that would continually show the time in HOURS:MINUTES on an ASCII terminal(not just xclock)?
An ascii terminal that you continue to type on? You could write the program using UNIX curses/ansiC. Do a 'man curses'.
Cheers,
Keith
you could also include the time as a PS1 variable to alter your prompt, however this is not continually updated, so your time will not be refreshed until you hit enter.
I'm not sure exactly how you want to use what you're talking about, but you could do something goofy like this (saving the script as "showtime.sh" ):
#!/bin/sh
clear
date +"%r"
sleep 1
/Users/$USER/bin/showtime.sh
-Cassj
Re: cassj's script - might cause system slowdown. The last line will launch a new process without terminating the current process, ie. after ten minutes you will have 600 processes all running showtime.sh.
Thanks Ygor. Sorry if I inadvertently wrote a virus
How about this:
#!/bin/sh
while [ 0 = 0 ] ; do
clear
date +"%r"
sleep 1
done
I'm not a UNIX expert. I guess I know enough to be dangerous
I couldn't find a way yet to make an infinite loop except for something like the "while" statement above. I'm using the default terminal in Mac OS X (10.3.1) Panther.
Regards,
Cassj