- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Passing valu to a menu driven program
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
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
05-05-2005 01:44 AM
05-05-2005 01:44 AM
Passing valu to a menu driven program
I have an executable file which is a menu driven program. I need to select certain option in the menu. For eg
#/usr/sbin/foo
Now one menu will appear with some options
1.abcd
2.efgh
3.ijkl
4.mnop
0.Exit
Enter your choice>
I need to select 2, and the 1 in the submenu and then 0 to exit. Can this selection be automated in a script?
Replys are higly appreciated.
TIA
Shahul
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2005 01:55 AM
05-05-2005 01:55 AM
Re: Passing valu to a menu driven program
PS3="Enter your choice> "
select answer in "1.abcd" "2.efgh" "3.ijkl" "4.mnop" "0.Exit"
do
case $answer in
"1.abcd" )
"2.efgh" )
"3.ijkl" )
"4.mnop" )
"0.Exit" )
exit 0;;
* )
echo "invalid choice"
esac
done
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2005 02:50 AM
05-05-2005 02:50 AM
Re: Passing valu to a menu driven program
Thanks for your response. I think you did not get it right/ I did not put it right. The menu with 0 to 4 option is displayed by an executable program, ie. /usr/sbin/foo. I can not change this executable. I want to select certain options from that menu. Manually I am able to select through keyboard, My question is, can I automate this by using a value / parameter?
Regards
Shahul
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2005 09:34 AM
05-05-2005 09:34 AM
Re: Passing valu to a menu driven program
/usr/sbin/foo <
1
0
EOF
So it will select 2, then 1, then 0.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2005 09:48 AM
05-05-2005 09:48 AM
Re: Passing valu to a menu driven program
You can download Expect from here:
http://hpux.connect.org.uk/hppd/hpux/Tcl/expect-5.43/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2005 01:34 PM
05-05-2005 01:34 PM