How to include menu based options in Shell script?

Hi Friends,

I have a menu based tool which requires input/option to proceed further. How to make a shell script ?

eg: menu looks like

Get_data.sh

to continue (y/n) : 

Here I need to key in "y" to proceed.

I want to prepare a script which should consider option y.

Not clear. Do you want to create a menu or do you want to supply input to an existing menu?

That "tool", is it a script or an executable binary? Can you modify it? Get_data.sh implies we are dealing with a shell script...

Please rephrase your request.

I would like to run an " existing menu and input option " both using a shell script.
the menu based tool is a binary

If you really only need to enter "y", then expect would be the tool of choice.

Unfortunately I may not post you a link to an example, because I'm not yet allowed to post URLs at the moment.

You do don't ever need the third party expect brute-forcing tool to read input from the user.

printf "%s" "do something (Y/N)"
read -n 1 INPUT # To read one keystroke on bash

# If BASH isn't available, you can read a keystroke followed by enter key
read INPUT

If you just want to read an answer from your user, use Coronas Code.

As what I understood, you want to control another program - and you want to automate that - and you don't have the possibility to change the source of that code, then expect may be a last possible solution.

Here's the example, if you needed(German website. The example itself should should be no problem though.

Automatisiertes Installations-Script / Shell (VMware) � debianforum.de