Special Characters and Escape Character
There are characters with special meanings assigned by Linux OS called special characters. You cannot use the characters in a file name or normal text sentence. If you want to use them without having a special meaning in a sentence, you need to use an escape character.
In bash, \
(backslash) is used as an escape character.
For example, if you want to display the following sentence with the echo command, you may have difficulty showing "
"
(double quotes).
He said “I'm learning Linux OS”.
With "
"
(double quotes) around the entire sentence in the command, you won't get any returned value.
echo "He said "I'm learning Linux OS"."
>
Without "
"
around the entire sentence in the command, you get a sentence; however, "
"
is not shown.
echo He said "I'm learning Linux OS".
He said I'm learning Linux OS.
If you use a backslash like below, you can display the intended sentence in the command line.
echo "He said \"I'm learning Linux OS\"."
He said "I'm learning Linux OS".