How to use pipeline in Terminal I'm trying to convert a P12 file to a PEM file. When I execute the command, the terminal asks me for three things:

P12 passphrase (I type it in, hit enter)
PEM passphrase (type it in, hit enter)
PEM passphrase confirm (type it in, hit enter)

I know I can execute a sudo command all in one shot by using the following:

echo sudopassword | sudo rm -rf /file.p12;


How can I add all three values in one shot?
The canonical unix tool for this job is expect.

Here is a short tutorial that should get you going on scripting a series of passwords to be entered when the appropriate prompt is detected by the tool.