From the course: Linux Bash Shells and Scripts: Streamlining Tasks and Enhancing Workflows with Automation

Unlock this course with a free trial

Join today to access over 24,700 courses taught by industry experts.

Displaying text with the echo command

Displaying text with the echo command

- [Instructor] The echo command is the most common way to print a message out to the terminal. To print value of variable, to print a message, et cetera. So, Bash does have a built-in echo command and there's a regular binary. When you just say echo, you're going to get the one built-in to Bash and it might work a little bit differently than the binary. Let's look at some options for echo. - n means don't print a trailing new line. So, you could print out a message and it'd stop there. Then if you do another echo, that would continue on the same line. That's handy sometimes. If you want to embed in the message, new lines and tabs, for example, then do the -e option. So, inside the quotes you can put a \n and echo will print a new line there. If you want to make sure that those escaped characters are not interpreted, then you could do a -E. And if they were enabled by default, then they won't perform their usual operation. And you might need the binary program. So, userbin echo. If…

Contents