0

I'd like to be able to allow multi-lined inputs using the Return key in a bash prompt. The user would be able to end the input with something like Control-D. Ideally it would allow pasting multi-lined strings as well without triggering an end of input at the first return.

Right now I'm using the read command for input and typing \n wherever I want a line break, then creating new lines when I send the input to a file with the line

echo "${txt//'\n'/$'\n'}" > $2

This works but it's rather kludgy. I'm open to any other way that's better than \n

  • Take a look: [Accept multiple lines of input in a bash script](https://stackoverflow.com/q/38811735/3776858) – Cyrus Apr 09 '22 at 20:40

0 Answers0