简体   繁体   中英

what does "\E" escape in ANSI-C Quoting of bash shell?

i have read this article. 3.1.2.4 ANSI-C Quoting

i understand most of the content, but i have questions about this small part.

\e
\E
    an escape character (not ANSI C)

So what does it escape? i tried to run

echo $'a\ebcdef'

It said:

acdef

It seems "\\e" removes the following character. But when i try to run

echo $'a\e bcdef'

I got

a bcdef

So what does the "\\e" escape?

This is related to escape sequences to format the display (colors, blinking...): Cf. https://misc.flogisoft.com/bash/tip_colors_and_formatting

For example, if you want to display "Hello world" in red:

$ echo $'\e[31mHello world\e[0m'

The same in green:

echo $'\e[32mHello world\e[0m'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM