Darkland | net

ANSI Colors

Published on 17 July, 2013 by Amanda
20110214
This: PS1='${debian_chroot:+($debian_chroot)}\[\033[01;33m\]\u\[\033[0m\]@\[\033[01;32m\]\h\[\033[0m\]:\w\$equals — essentially — this:user@localhost:~$
See also:Tweaks And That Sort Of Jive

20101120

So far I've had to use printf instead of echo to get the ANSI codes to be interpreted correctly. That changes the script logic quite a bit.
#!/bin/bash
thishost=$HOSTNAME; printf "\33[1;33mThis is a great song\33[0m\33[1m:\33[0m \33[1;34mEternal Nightmare -- Little Copy\33[0m \33[1m--amj\33[0m\n\n"; printf "\33[1;33mPlease enter your password\nto run updates for\33[0m \33[1;32m$thishost\33[0m.\n\n"; sudo apt-get update printf "\n\33[1;32m$thishost\33[1;33m is currently running \nthe following kernel version\33[0m\33[1m:\33[34m "; uname -r printf "\33[0m\n"; sudo apt-get dist-upgrade

ANSI Color Tables:
Reference: http://ascii-table.com/ansi-escape-sequences.php

Text AttributeValue
None0
High Intensity
(bold)
1
Underline
(monochrome display only)
4
Blink5
Reverse7
Invisible8
Color
Attribute
Foreground
Value
Background
Value
Black3040
Red3141
Green3242
Yellow3343
Blue3444
Magenta3545
Cyan3646
White3747



Back