ANSI Escape Sequences for writing text in "BOLD" and "UNDERLINE" . A more about ANSI escape sequences can be found here
//BOLD
$ echo -e "\033[1mThis is a BOLD line\033[0m"
This is a BOLD line
#Using tput
tput bold
echo "This" #BOLD
tput sgr0 #Reset text attributes to normal without clear.
echo "This" #NORMAL
//UNDERLINE
$ echo -e "\033[4mThis is a underlined line.\033[0m"
This is a underlined line.
5 comments:
Wow !!!! I never knew you can type in bold/underline in command prompt. This kinda looks like real amusing !!!
Here's a tricky one: I use /bin/ls -lhG to list files which provides color coding, but if I process the listing with sed (to highlight hard linked files), all the other color information gets stripped. Know a way around that?
-Rob
(using Mac OS X 10.6)
rharder:
echo 'Hello World!' | sed $'s/World/\e[1m&\e[0m/'
rharder: Eh, I mean:
ls --color | sed ...
Works at least in Ubuntu's bash.
@Honza Thanks. I don't see where that would permit escape sequences to pass. I suppose I could make a convoluted regular expression to match the escape sequences and then try to reprint them with \1 or something. Sounds ugly. =(
Post a Comment