More Information About echo
You’ve already seen the most simple way to use echo
, which is to either display a message on the screen or send text into a text file. What you haven’t seen yet is echo
's various formatting options.
If you use it with the -n
switch, you’ll prevent it from creating a new line at the end of the text output, like this:
[donnie@fedora ~]$ echo -n "The fat cat jumped over the skinny dog."
The fat cat jumped over the skinny dog.[donnie@fedora ~]$
Use it with the -e
switch, and you’ll be able to use some backslash options. For example, to insert a vertical tab into a line of text, use the -e
switch with the \v
option, like this:
[donnie@fedora ~]$ echo -e "The fat cat jumped\v over the skinny dog."
The fat cat jumped
over the skinny dog.
[donnie@fedora ~]$
To insert a horizontal tab, use the \t
option, like this:
[donnie@fedora ~]$ echo -e "The fat cat jumped...