From the course: Linux: Bash Shell and Scripts

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Displaying text with the echo command

Displaying text with the echo command - Linux Tutorial

From the course: Linux: Bash Shell and Scripts

Start my 1-month free trial

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…

Contents