0

Got struck while trying to write a shell script which should automatically give input.

While running a script for eg: adpatch.sh

It Prompts for Multiple inputs like:

Do you currently have files used for installing or upgrading the database
installed in this APPL_TOP [YES] ? need to give input here


Do you currently have Java and HTML files for HTML-based functionality
installed in this APPL_TOP [YES] ? need to give input here


Do you currently have Oracle Applications forms files installed
in this APPL_TOP [YES] ? need to give input here


Do you currently have concurrent program files installed
in this APPL_TOP [YES] ? need to give input here

so without using Command Line Arguments, is there any other way of giving the input automatically? Thanks in Advance.

1 Answer 1

1

I believe that expect is what you want. You may need to install it first ("apt-get install expect" from Debian/Ubuntu based Linux distros).

Expect has the advantage of pairing responses with specific questions, instead of just blindly replying with "YES".

From the man page:

In general, Expect is useful for running any program which requires interaction between the program and the user. All that is necessary is that the interaction can be characterized programmatically. Expect can also give the user back control (without halting the program being controlled) if desired. Similarly, the user can return control to the script at any time".

Sign up to request clarification or add additional context in comments.

1 Comment

Good advice although it needs a lot more work than the alternative of redirecting input. There is also "autoexpect" (wiki.tcl.tk/1865) that automates the writing of expect scripts! With minor changes you can have a working expect script!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.