From the course: Linux: Bash Shell and Scripts
Unlock the full course today
Join today to access over 24,800 courses taught by industry experts.
Displaying text with the echo command - Linux Tutorial
From the course: Linux: Bash Shell and Scripts
Displaying text with the echo command
- [Narrator] The echo command is how you print a message, and in scripts it's pretty common to want to print a message. There's a few options to echo and there's a couple in particular that are really handy to know about. The -n means don't print usual trailing newline. Sometimes you want to echo something out, and then on that same line of output, echo something else out. That's -n, or maybe you want to print a prompt and have the cursor stop there while the user types in an answer on the same line. The -e tells echo to interpret some special characters. The most common are \n and \t. \n is print a newline, and you could do a sequence of those if you want to print a bunch of new lines. \t means print a tab character. And, every once in awhile, maybe some version of Bash you got, or some settings who are set somewhere, maybe you need the -E which will disable those special characters in case you want to see the backslash and the n instead of a newline. Echo is particularly helpful…
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 documentation1m 57s
-
Setting the script interpreter and permissions6m 29s
-
(Locked)
Time commands and set variables9m 10s
-
Bash startup4m 28s
-
(Locked)
Sourcing and aliasing with bash5m 34s
-
(Locked)
Displaying text with the echo command4m 10s
-
(Locked)
Challenges: Scripts with exported variables, sourcing, and echo2m 6s
-
(Locked)
Solutions: Scripts with exported variables, sourcing, and echo4m 20s
-
-
-
-
-