Requires Free Membership to View
There are a couple of options for you. One option is to use a scripting language called Expect. Expect is a scripting language that can interface with any command line interface. You tell Expect what to "expect", and your Expect script will supply the next answer. For instance, you can invoke SQL*Plus from Expect. You tell Expect to expect the prompt for the username. Then, when Expect sees this prompt, it passes the supplied username to the SQL*Plus executable. You can use it to do the same thing in your example. Have your Expect script call "cpio -r" for you. Tell it what to expect in return and how to respond to that prompt. Expect is one of the great scripting languages that no one talks about!
Otherwise, you might want to consider dropping the directory path from your files that you archive with cpio. Or consider using something other than cpio to do the archive.
For More Information
- Dozens more answers to tough Oracle questions from Brian Peasland are available.
- The Best Oracle Web Links: tips, tutorials, scripts, and more.
- Have an Oracle or SQL tip to offer your fellow DBAs and developers? The best tips submitted will receive a cool prize. Submit your tip today!
- Ask your technical Oracle and SQL questions -- or help out your peers by answering them -- in our live discussion forums.
- Ask the Experts yourself: Our SQL, database design, Oracle, SQL Server, DB2, metadata, object-oriented and data warehousing gurus are waiting to answer your toughest questions.
This was first published in January 2003

Join the conversationComment
Share
Comments
Results
Contribute to the conversation