You might have heard of echo as the command to “print lines.” Technically it emits each of the arguments in turn, separated by a space character, and prints a single newline at the end. Let’s explore this with some examples.

As you can see the cursor appears on a new line below the output. Since the prompt does not contain a newline, that newline must be part of the output of echo. We can confirm this by printing the output character representations:


This page is a preview of The newline Guide to Bash Scripting

No discussions yet