From the course: Learning Bash Scripting
Unlock this course with a free trial
Join today to access over 24,900 courses taught by industry experts.
Displaying text with "echo" - Bash Tutorial
From the course: Learning Bash Scripting
Displaying text with "echo"
One of the most basic commands or built-ins that we'll use in a Bash script is the echo command. echo prints out information normally to the standard output, but it can be directed elsewhere. The syntax for the echo command is pretty simple. We just type echo followed by whatever we want to output. We've already been using echo in the course so far to help us see the results of expansions and substitutions. But now let's take a more detailed look at echo and see how we'll use it in different ways to display text in a script. echo is useful for outputting static text or variables or any value. And we can compose strings and variables and substitutions and expansions into one echo statement. So we can use programmatic output right alongside static text. In Bash, if I want to stick two pieces of text next to each other, I'll just write them one after the other. For example, I could write echo hello, or I could write echo hello world. And I could include other things in there too, like…
Contents
-
-
-
-
(Locked)
Understanding Bash script syntax7m 24s
-
(Locked)
Displaying text with "echo"5m 8s
-
(Locked)
Working with variables6m 19s
-
(Locked)
Working with numbers10m 2s
-
Comparing values with test7m 6s
-
(Locked)
Comparing values with extended test5m 43s
-
(Locked)
Formatting and styling text output8m 38s
-
(Locked)
Formatting output with printf5m 33s
-
(Locked)
Working with arrays5m 10s
-
(Locked)
Challenge: Make a script that generates a system report1m 10s
-
(Locked)
Solution: Make a script that generates a system report2m 48s
-
(Locked)
-
-
-
-