Visit The New, Modern Unix Linux Community


How to automate user menu selections?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to automate user menu selections?
# 1  
Hammer & Screwdriver How to automate user menu selections?

Hello all, I am sort of new to Shell programming and to this forum. I want to create a script that auto selects menu options.

lets say I have a menu.

MAIN MENU
1.) opt1
2.)opt2
3.)opt3

I want the script to automatically select option 1.
# 2  
This is a very vague request... Is this a homework assignment?

What operating system are you using?

What shell are you using?

Are you saying that you have a script that can process one of three options, and if no option is specified when the script is invoked it should default to the 1st option?

What is supposed to happen when each of these three options is chosen?

Why have three options if your script is only supposed to process the 1st option?
# 3  
Nope is not for homework.
I am using linux ksh.

The script displays a menu to the user. the user has to select an option. then the it shows a submenu. basically what I am trying to do is to automate responses, as i have to do this many times a day, same responses.
# 4  
You have lots of options; two obvious ones are:
  1. make a copy of the script and modify it to just execute the options you want,
  2. use a printf command to pipe the script the responses it will need to select the options you want.
# 5  
could you provide an example of how I would pass the options using printf?

unfortunately i don't have access to editing the original script, :/
# 6  
Code:
printf 'Response to select 1st menu option\nResponse to select submenu option\n' | script_name

How do you run the script with the menu options if you can't read it?
# 7  
There is two original scripts already written. the first one which i have to run with sudo privileges that displays the menu. this first script then sends variables and options chosen to a second massive script which contains several different functions.

I did a tail -f on the log of the second scrip which is the one that actually gets the task done while i selected the options and ran my task. I am able to read this and i know the functions that get called. Eventually i would want to write my own script but with only the functions that i need. Hope this made some sense. thank you for the help Don.

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #930
Difficulty: Easy
In computing, an epoch is a date and time from which a computer measures determines the release date of the operating system.
True or False?

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to do user-preset login to Bash shell then automate path modification?

How do a user login with full user-environment preset to Bash shell then automatically do path modification with few script codes, either on command-line or put it in a script file. what i tried: bash --login -c PATH="/ANewPath:${PATH}" bash --login -c 'PATH="/ANewPath:${PATH}"; export PATH'... (2 Replies)
Discussion started by: abdulbadii
2 Replies

2. Shell Programming and Scripting

Display user selction from bash menu

I am trying to display the text the user selects from a bash menu. The below will display the menu and allow the user to enter a number, but will not display the choice selected. bash while true do printf "\n please make a selection from the MENU \n ... (4 Replies)
Discussion started by: cmccabe
4 Replies

3. Shell Programming and Scripting

Automate the menu options using shell script

I have a menu option which will look as follows Select a menu option 1.change password 2.login as root user 3.show system version 4.quit Select> 1 please enter the new password: unix reenter the new password: unix press any key to enter (then displays again the menu options to enter the... (4 Replies)
Discussion started by: shivakumar6g
4 Replies

4. Shell Programming and Scripting

How to automate user selection options in shell script?

Hi There, I am trying to write a script which has to pick the prompted options by itself(i mean option to choose will be passed) here is real scenario i am trying to do. i have an executable(diagnos) which gets called in shell script, when the executable (diagnos) runs i get following as... (8 Replies)
Discussion started by: sairam_9191
8 Replies

5. UNIX for Advanced & Expert Users

Can we Automate the User creation and setting password through a script in solaris 10

Hi, I am using Solaris 10 OS and Bash shell.Is there any way can we automate User creation and setting passwords through a script or any freeware tool. Advance thanks for your response. (1 Reply)
Discussion started by: muraliinfy04
1 Replies

6. Shell Programming and Scripting

How to automate user's inputs.

Hi Friends, I am wrinting a shell script MorningChecks.sh which will call another script StartServer.sh. But the latter script requires user's inputs to complete. I want to automate this. So can you please let me how this can be achieved? Any help would be highly appereciated. ... (3 Replies)
Discussion started by: singh.chandan18
3 Replies

7. Shell Programming and Scripting

menu selections

I am trying to find a way to allow users to select multiple options in a shell menu. I am using case and it gives menu options 1-9, how can I set this up so that it give the user the ability to choose more then one option, ie 1,2 or 3,4,5, etc... (4 Replies)
Discussion started by: lwif
4 Replies

8. Shell Programming and Scripting

Presenting the user a menu in Bash ...

Hello, I am trying to write a bash script function to present the user a menu of options. The following is what I have so far: function MainMenu { while ] do echo "--------------------------------------------------------------------------------" echo... (4 Replies)
Discussion started by: ckoeber
4 Replies

Featured Tech Videos