To display some pre-formatted text onto screen, we need the following 2 capabilities:
Construct Multiple Text
There are 2 ways to construct multiple line strings:
String literal
String Literal 12345text = "First LineSecond LineThird Line"Use cat
cat 123456text = $(cat << EOFFirst LineSecond LineThird LineEOF)
Print Multiple Text to Screen
For some reason, echo
command will eat all the line break in the text, so we should use printf instead of echo.
And printf supports back-slash-escape, so we can use \n
to print a new-line on screen.