HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: clock
Operating System - HP-UX
1834543
Members
3409
Online
110069
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2006 01:15 PM
02-12-2006 01:15 PM
clock
I want to add a clock in a script. the script is used for showing menu. I want that the time will be changed after 5 sec. how can i do that
System Name : hpdev Time :
Choose one of the following option:
[P] for Password Change
[U] for Unlock user
[E] for Exit
System Name : hpdev Time :
Choose one of the following option:
[P] for Password Change
[U] for Unlock user
[E] for Exit
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2006 05:33 PM
02-12-2006 05:33 PM
Re: clock
Do you want to change the time after 5 sec eventhough the input is given for Choose or not?
It is easy to change the time with clear command as like,
while [[ 1 ]]
do
echo "System Name: `hostname` Time: `date`"
echo "Choose"
echo "[P] for Password Change
[U] for Unlock user
[E] for Exit"
read OPTION
# Use some function to do operation.
here...()
clear
sleep 5
done
--
Muthu
It is easy to change the time with clear command as like,
while [[ 1 ]]
do
echo "System Name: `hostname` Time: `date`"
echo "Choose"
echo "[P] for Password Change
[U] for Unlock user
[E] for Exit"
read OPTION
# Use some function to do operation.
here...()
clear
sleep 5
done
--
Muthu
Easy to suggest when don't know about the problem!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2006 06:53 PM
02-12-2006 06:53 PM
Re: clock
You can use this as a base for what you want. Mind that it will 'destroy' old traps you set !
But it will print out the date every 5 seconds.
#!/bin/ksh
trap '/usr/bin/date' HUP
( while true
do
kill -HUP $$
sleep 5
done
) &
ss=$!
trap '/usr/bin/kill $ss' INT
read a
kill $ss
But it will print out the date every 5 seconds.
#!/bin/ksh
trap '/usr/bin/date' HUP
( while true
do
kill -HUP $$
sleep 5
done
) &
ss=$!
trap '/usr/bin/kill $ss' INT
read a
kill $ss
Every problem has at least one solution. Only some solutions are harder to find.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2006 12:53 AM
02-13-2006 12:53 AM
Re: clock
If you want the script to respond to the menu commands and at the same time, update the time, the script will be quite tricky to implement. Essentially, you would wait for input for up to 5 seconds, then if nothing was typed, redisplay the header which includes the date. Be sure to use $(date) rather than the obsolete grave accents `date` as it is very easy to mistype the characters. The date command has many options to show just hour:min or add secs, etc. To timeout the read command, see the man page for line.
Bill Hassell, sysadmin
Bill Hassell, sysadmin
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP