From 871f28d44ce8432d57f8b03dd8e3c93ae743d626 Mon Sep 17 00:00:00 2001 From: Asocia Date: Wed, 1 Dec 2021 17:58:13 +0300 Subject: [PATCH] TIL: Echoing a multiple line variable --- bash-scripting/echoing-a-multiple-line-variable.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 bash-scripting/echoing-a-multiple-line-variable.md diff --git a/bash-scripting/echoing-a-multiple-line-variable.md b/bash-scripting/echoing-a-multiple-line-variable.md new file mode 100644 index 0000000..7f9bf9d --- /dev/null +++ b/bash-scripting/echoing-a-multiple-line-variable.md @@ -0,0 +1,3 @@ +If you are wondering why `echo` doesn't print the output on multiple lines, make sure there is `"` around your variable. + +> The difference is that the double-quoted version of the variable (echo "$RESULT") preserves internal spacing of the value exactly as it is represented in the variable — newlines, tabs, multiple blanks and all — whereas the unquoted version (echo $RESULT) replaces each sequence of one or more blanks, tabs and newlines with a single space.