What does this mean?
echo -e \e
What:
The -e
flag for echo
allows it to interpret certain sequences as having special meanings. For GNU echo those are:
\\ - backslash \a - alert (BEL) \b - backspace \c - produce no further output \e - escape \f - form feed \n - new line \r - carriage return \t - horizontal tab \v - vertical tab \0NNN - byte with octal value NNN (1 to 3 digits) \xHH - byte with hexadecimal value HH (1 to 2 digits)
So these allow insertion of specific byte patterns into the text stream.
\e
is hex value 0x1b
also called escape. Not to be confused with escaping strings.
Why:
There are many reason you might need to insert specific bytes sequences into the stream. But one common reason is to allow communication with your terminal program. What are generally refered to as ansi escape codes. This is what the word escape refers in case of \e
.
There is more explanation of this HERE.
echo -e "\e[2J\e[2;4HRow two column four\n"
It first clear screen and then go to row 2 and column four and write some text. – hschou Apr 01 '17 at 21:13echo -e "hello\e"
prints-e hello\e
– Fox Apr 04 '17 at 16:25