So I needed to take in a pasted stdin that was multiple lines. Using just read or any of the flags it provides don’t give a nice clean way to do this. However, using cat and sed, you can provide a few nice ways to allow a user to end the input stream and submit their entry:


echo "Pipe in certificate, or paste and it ctrl-d when done"  

Blank Line:

echo "Paste certificate and end with a blank line:"  
keyvariable=$(sed '/^$/q')  

Thanks, stackoverflow

Blog Logo

Mario Loria




Because gets old after a while.

Back to Overview