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 - Linux Tutorial
From the course: Linux Bash Shells and Scripts: Streamlining Tasks and Enhancing Workflows with Automation
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
Exploring the Bash documentation2m 27s
-
(Locked)
Setting the script interpreter and permissions5m 49s
-
(Locked)
Date and time commands5m 36s
-
(Locked)
Shell variables4m 28s
-
(Locked)
Bash startup2m 52s
-
(Locked)
Sourcing and aliasing with Bash3m 31s
-
(Locked)
Displaying text with the echo command4m 12s
-
(Locked)
Challenge: Exported variables, sourcing, and echo2m 17s
-
(Locked)
Solution: Exported variables, sourcing, and echo4m 7s
-
-
-
-
-