If the expression contains special characters, the Shell will replace it. For example, using a variable in double quotes is a substitution, and an escape character is also a substitution.
As an example:
- #!/bin/bash
- a = Ten
- Echo-e "Value of A is $a \ n"
Operation Result:
Value of A is 10
here-e indicates the substitution of the escape character. If you do not use the-e option, it is output as-is:
Value of A is 10\n
The following escape characters can be used in Echo:
Escape Character |
meaning |
\\ |
Back slash |
\a |
Alarm, Bell |
\b |
BACKSPACE (delete key) |
\f |
Page Break (FF), moving the current position to the beginning of the next page |
\ n |
Line break |
\ r |
Enter |
\ t |
Horizontal tab (Tab key) |
\v |
Vertical tab |
you can suppress escaping by using the-e option of the Echo command, which is not escaped by default, or by using the-N option to prevent the insertion of line breaks.
This article is from the Linux Security Advisor blog, so be sure to keep this source http://chengyangyang.blog.51cto.com/9473151/1700113
Shell substitution: Shell variable substitution, command substitution, escape character