Quote:
Originally Posted by cdgary
How do you deal with that in your script or any other situation where you have to respond to something the system will ask before moving forward, like a password or yes/no after performing a command?
|
As weitjong mentioned there are several ways to do this, but my favorite is to use
Expect, which is in the Fedora repos. Basically, the way Expect works is you write a script that automates answers for what you "expect" a program to ask you. In fact, you don't even have to write the script yourself; Expect includes a utility called autoexpect which can create it for you from an example session that you go through. It's very simple to use.
One thing you should be careful about, though, is storing plain-text passwords in scripts. That's usually a big security no-no. There are ways to avoid that by using encryption or other methods.