|
-
January 30th, 2001, 06:38 PM
#1
a continous `date` script
in a `command line only` machine, is there any way to echo the date command, specially the hour, to the screen, but that the same keeps refreshing, until i press a key, or i do a `ctrl + c`?
i`ve read all the bash scripting documentation that i found in inet, but found nothing.
the closest thing i found was the `\r` command, but that doesn`t work.
any help will be much welcomed. i`m totally new to scripting/programming in general.
-
January 31st, 2001, 06:19 PM
#2
Use Curses. By performing a destructive backspace, you can do something like:
Wed 31 Jan 2001 01:10:49 << print time
Wed 31 Jan 2001 01:10: << two backspaces
Wed 31 Jan 2001 01:10:50 << print new digits
Wed 31 Jan 2001 01:10:5 << one backspace
Wed 31 Jan 2001 01:10:51 << replace last digit
repeat that last for next 9 seconds, then backspace 4 characters and print 01:11:00 etc.
In a shell:
#!/bin/sh
bs=$(tput cub1) # Read the tput(1) and terminfo(4) man pages
x=0
while [ "$x" -lt 10 ] ; do
echo -n $x; sleep 1; echo -n "$bs"
done
[This message has been edited by Prince (edited 01-31-2001).]
-
January 31st, 2001, 06:33 PM
#3
prince, thanks, i don`t comletelly understand what you`re trying to tell me, but i`ll try that tonight at home, thank you very very much.
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|