- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- User defined key for interrupting a infinite loop ...
Categories
Company
Local Language
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
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
Community
Resources
Forums
Blogs
- 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
08-08-2002 03:19 AM
08-08-2002 03:19 AM
User defined key for interrupting a infinite loop script !
Any idea on implementing a user defined key e.g. "q" to interrupt a ever running while loop script ?
The reason for my question is that I want to write a script to continuosuly check some process until the user click on the "q" in the keyboard.
Appreciated it if you can give me some hints.
Cheers,
Chris
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2002 03:22 AM
08-08-2002 03:22 AM
Re: User defined key for interrupting a infinite loop script !
live free or die
harry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2002 03:27 AM
08-08-2002 03:27 AM
Re: User defined key for interrupting a infinite loop script !
Why dont you use the unitl loop for this purpose?
-Bonny-
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2002 03:59 AM
08-08-2002 03:59 AM
Re: User defined key for interrupting a infinite loop script !
============================================
#!/bin/sh
trap 'echo bye && stty intr ^C && exit' 2
stty intr q
while [ true ]
do
date
sleep 1
done
============================================
I changed the interruption to the letter "q" and back to ^C when we quit the program.
Jean-Luc
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2002 07:45 AM
08-08-2002 07:45 AM
Re: User defined key for interrupting a infinite loop script !
I would like to use Bourn shell.
Regards,
Chris,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-09-2002 12:39 AM
08-09-2002 12:39 AM
Re: User defined key for interrupting a infinite loop script !
I don't see the problem.
sh Bourne-shell command programming language and commands
interpreter residing in file /usr/old/bin/sh. Can
execute commands read from a terminal or a file. This
shell lacks many features contained in the POSIX and
Korn shells. The Bourne shell will be obsoleted.
Users are strongly encouraged to switch to the POSIX
shell. The Bourne shell will still be available as
/usr/old/bin/sh, for those users have to use it.
Jean-Luc