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:

Ctrl+d:

#!/bin/bash
echo "Pipe in certificate, or paste and it ctrl-d when done"
keyvariable=$(cat)

Blank Line:

#!/bin/bash</p><p>
echo "Paste certificate and end with a blank line:"
keyvariable=$(sed '/^$/q')

Thanks, stackoverflow

Mario Loria is a builder of diverse infrastructure with modern workloads on both bare-metal and cloud platforms. He's traversed roles in system administration, network engineering, and DevOps. You can learn more about him here.