Re: [opensuse] BASH Help -- howto provide automatic input to program called in script?
Aaron Kulkis wrote:
feel free to repost to the list:
David C. Rankin wrote:
Listmates (also cc'ed to dnh)
How do I provide a response to a program called from within a script from within the script itself? Sort of like a password chat program waiting on the prompt? Specifically, I have automated setting up a self signed server certificate for apache2 calling openssl from the script:
# Generating Private Server Key openssl genrsa -des3 -out server.key 1024
command << endflag everything written here will be fed to command on stdin until reaching THIS line endflag #this is called a "Here Document" # bash also has something called a "Here String" using <<<
man bash and then use the keyboard sequence: /here doc
Hope that helps, Dave
# Generate Certificate Signing Request (CSR) openssl req -new -key server.key -out server.csr
# Remove Passphrase from Key echo -e "\n\t${lightblue}Removing Passphrase From Key To Eliminate PW Request cp server.key server.key.protected openssl rsa -in server.key.protected -out server.key
Each of the openssl requests ask either to create a password or to enter a password. Is the chat program the best solution?
I missed in my page guess on man bash. It was actually on page 1331. Thank you for the help again! -- David C. Rankin, J.D.,P.E. Rankin Law Firm, PLLC 510 Ochiltree Street Nacogdoches, Texas 75961 Telephone: (936) 715-9333 Facsimile: (936) 715-9339 www.rankinlawfirm.com -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
participants (1)
-
David C. Rankin