Complex Input/Output Redirect

Hi All,

Sorry if the title is not good but I did not know how to explain with only some words!

What I meant is: I have a unix command built from a private application vendor that when executed it prompts for two entries by the keyboard, let's say, for example:

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Enter your:
    UserName: <Keyboard Enter UserName> <Press EnteR>
    EMail      : <Keyboard Enter EMail> <Press EnteR>
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

After inputting the information above using the keyboard and pressing <EnteR>, it shows an output like below:

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
                        ENCRIPTING THE PASSWORD.....

    ENCRIPTED PASSWORD    : XXXXXXXXXXXXXXX
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

Finally, my question is:

Is there a way to put the command above inside a shell script?
The user must enter the two fields and after I need to get the "Encripted Password".

Thanks for your attention!

Yes, use Expect. And input the variables into your ARGV array (or the comparable for bash).