Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
I have been googling for a while to solve a little problem in my script but I couldn't find any solution for it.
I have a shell script that requires an imput to be typed during its execution and I don't know how I can "answer" this prompt automatically, without having to interact with the script.
It's a script to restore an Oracle database. The script calls a .sql file, in this .sql file there is the following command:
recover database until cancel using backup controlfile;
after running this command the message below is displayed requiring an imput that can be: filename, AUTO or CANCEL.
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
I'm always going to use option "AUTO", so I need to find a way to tell the script to use this option whenever the prompt appears.
after running this command the message below is displayed requiring an imput that can be: filename, AUTO or CANCEL
I am no oracle expert, but if your input is always going to be AUTO, then cant you hard code this into your script? If there is a facility to pass this argument to the command that you are issuing it would save you the hassle of the program prompting you for stdin.
ie recover database until cancel using backup controlfile --AUTO;
I made that last part up --AUTO ... it would be handy if you could do that i think.
I'm really thankful for your help and sorry for the delay. This issue was
solved by just putting the word "AUTO" after the recover command. I guess it
is an sql specific sintax because I have neven seen this kind of sintaxe
used in shell scripts.
The following is a piece of the code:
recover database until cancel using backup controlfile;
AUTO
alter database open resetlogs;
Thank you guys again!!!
Obs: This language "express" seems to be very good... I'm going to spend
some time studying it.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.