print "\e[4m", $prompt, "\e[24m", "\e[1m";
It seems it doesn’t work in bash:
[root@dev-test ~]$ echo "\e[4mhello world\e[24m\e[1m"
\e[4mhello world\e[24m\e[1m
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
“\e” means ESC which is used for VT100 escape sequences and similar. Perl understands the “\e” escape sequence in strings and interprets it as a the ESC character (it can also be written as “\33” or “\x1b”).
To use ESC with echo, supply the
-eoption which enables these escapes to be processed:The transformation from the two characters “\e” to the single ESC character (with the value 0x1B) is done by
echoitself (with-e) — the shell does not handle the escapes which appear in quotes. The link forechoabove also includes an example of such usage.Happy coding.