- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Standard template / Menu
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
Discussions
Discussions
Forums
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
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
тАО11-07-2009 01:13 AM
тАО11-07-2009 01:13 AM
I am writing an operators menu and would like to present the users with a default display with the status of apps / processes / tasks displayed.
Is there a way I can display a standard template each time the user chooses an option so that each screen is the same for each menu?
I can probably create a function that echo's the template around the executed commands but is there a way to set this up so the menu is always in the outer sector of the display / output and then doesn't matter what is displayed in the middle or inner section?
Hope i've explained ok?
Thanks
Chris
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-07-2009 02:18 AM
тАО11-07-2009 02:18 AM
SolutionThis is a bit tedious to do efficiently using shell scripts.
You could print out your template, then move the cursor back up to the beginning of the content (using tput, see "man tput" for more info).
When you are moving to another menu, first move the cursor back to the beginning of the content and fill the content area with space characters: they will overwrite the old menu. Then move the cursor back again to write in the new menu.
You can optimize this by making all your menu content lines the same length (by filling them out with spaces), then just overwriting the old menu with the new one.
If you use a more advanced scripting language (like perl) or a real programming language, you can use the functions of the curses library to help you. Often the curses library will auto-optimize the output for you, automatically moving the cursor around to change only the characters that need to be changed. It also has a concept of "windows", which is exactly what you need here.
Man pages on curses:
http://docs.hp.com/en/B2355-60127/curses_intro.3X.html
http://docs.hp.com/en/B2355-60127/curses.5.html
(+ man pages for each individual curses function)
If you are unfamiliar with the curses library and wish to use it, I'd recommend reading a good book on curses programming. For example:
John Strang, Programming with curses, O'Reilly, ISBN 0-937175-02-1
Ncurses is a free extended re-implementation of curses. Its documentation might be useful with regular curses too:
http://tldp.org/HOWTO/NCURSES-Programming-HOWTO/
MK
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-07-2009 03:56 AM
тАО11-07-2009 03:56 AM
Re: Standard template / Menu
I am open to suggestions to be honest and will take a look at the curse stuff for sure ...
I am familair with tput so thanks for the suggestions.
Chris.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-07-2009 08:04 AM
тАО11-07-2009 08:04 AM
Re: Standard template / Menu
a couple of years back, there was a related post here. one response included a set of awk scripts while another had a purely shell version. both used tput codes for hightlighting, and did pretty much what it sounds like you want to do.
I no longer have the link, it might be worth some searching around.
there also used to be a Tc/Tkl based menuing system available..that might have been at one of the GNU sites.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-07-2009 08:56 AM
тАО11-07-2009 08:56 AM
Re: Standard template / Menu
For pure simplicity, this thread has several variations of shell-based menu scripts:
http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=993074
Regards!
...JRF...
- Tags:
- select
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-08-2009 07:51 AM
тАО11-08-2009 07:51 AM
Re: Standard template / Menu
http://forums11.itrc.hp.com/service/forums/questionanswer.do?threadId=984784
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-09-2009 03:54 AM
тАО11-09-2009 03:54 AM
Re: Standard template / Menu
Thank you very much - just what I was looking for and gives me something to work towards.
Regards
Chris