How to preserve line breaks when storing command output to a variable?

I’m using bash shell on Linux. I have this simple script … #!/bin/bash TEMP=`sed -n “https://stackoverflow.com/””Starting deployment of”‘/,/'”Failed to start context”‘/p’ “/usr/java/jboss/standalone/log/server.log” | tac | awk “https://stackoverflow.com/””Starting deployment of”‘/ {print;exit} 1’ | tac` echo $TEMP However, when I run this script ./temp.sh all the output is printed without the carriage returns/new lines. Not sure if … Read more