Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

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?

share|improve this question
    
... just don't lose the file.txt from the end of that command. –  bmike Aug 11 '12 at 4:06
    
@bmike Thanks for responding, but could you be more clear? Should I do something like echo password | echo password | echo password | normal command? –  Jack Humphries Aug 11 '12 at 4:07
add comment

1 Answer

up vote 1 down vote accepted

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.