How to Parse a Prompt?

On the command, when I type in certain commands, they will display a prompt waiting for some input. When I type in the requested input, it will display the info I requested.

For example, if I enter the telnet command, it will display a telnet prompt and wait for me to enter something.

I wonder in my script if I can parse the command line to see if a prompt is popped up. If it is, then supply the requested info that is stored in a file.

OS is Solaris 2.8 and running ksh.

Please help. Thanks.

There is such a wondrous thing. Search the forums for expect.