Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

jackhdev

macrumors 6502
Original poster
Apr 9, 2011
343
0
Bismarck, North Dakota
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:

Code:
echo sudopassword | sudo rm -rf /file.txt;

How can I add all three values in one shot? Thanks
 
echo each parameter followed by a newline.

For example:
Code:
echo -e "${param1}\n${param2}" | openssl...
 
Should work fine, I have used this technique in a number of scripts, one that generates certs as well :)

Expect should do the trick though.

Really? Could you put give me the same thing you gave me above, but set the passwords to "test"?

Should it be: echo -e "$test\n$test\n$test" | openssl ...
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.