15 | echo command

Linux Command Line Tutorial


ANSI Escape Code
https://en.wikipedia.org/wiki/ANSI_escape_code#Colors

In this video, we will learn how to use the echo command. The arguments passed to echo are printed to the standard output.

Echo is commonly used in shell scripts to display a message or output the results of other commands.

Although it is not necessary to enclose arguments in double-quotes it is good practice to do so.

If using ” each character enclosed within is preserved. Variable and commands will not be expanded.

Echo can be used with pattern matching characters, such as the wildcard characters.

echo "My txt files are: *txt"

Creating a variable in the shell for the current session. Don’t leave any space between equal sign.

myString="Hello World"
x=10

Display variable:

echo $myString
echo "x"

Echo can redirect commands output.

echo "Directory contents: $(ls -l)"


Options

CommandEffect
^OSave changes
^XExit nano
Save and Exit commands