#!/bin/bash # The escape sequence begins with Decimal 27 / Octal 033 / Hex 1B # You can make this in emacs by -q followed by the three digit octal # or the esc key. # echo must be called with -e to actually print this character. function setfg { COLOR=$1 case $COLOR in [Bb][Ll][Aa][Cc][Kk]) echo -en "";; [Rr][Ee][Dd]) echo -en "";; [Gg][Rr][Ee][Ee][Nn]) echo -en "";; [Yy][Ee][Ll][Ll][Oo][Ww]) echo -en "";; [Bb][Ll][Uu][Ee]) echo -en "";; [Mm][Aa][Gg][Ee][Nn][Tt][Aa]) echo -en "";; [Cc][Yy][Aa][Nn]) echo -en "";; [Ww][Hh][Ii][Tt][Ee]) echo -en "";; [Gg][Rr][Ee][Yy]) echo -en "";; [Bb][Oo][Ll][Dd]) echo -en "";; [Uu][Nn][Dd][Ee][Rr][Ll][Ii][Nn][Ee]) echo -en "";; [Nn][Oo][Rr][Mm][Aa][Ll]) echo -en "" ;; *) tput sgr0 ;; esac } function setbg { COLOR=$1 case $COLOR in [Bb][Ll][Aa][Cc][Kk]) echo -en "";; [Rr][Ee][Dd]) echo -en "";; [Gg][Rr][Ee][Ee][Nn]) echo -en "";; [Yy][Ee][Ll][Ll][Oo][Ww]) echo -en "";; [Bb][Ll][Uu][Ee]) echo -en "";; [Mm][Aa][Gg][Ee][Nn][Tt][Aa]) echo -en "";; [Cc][Yy][Aa][Nn]) echo -en "";; [Ww][Hh][Ii][Tt][Ee]) echo -en "";; [Gg][Rr][Ee][Yy]) echo -en "";; [Nn][Oo][Rr][Mm][Aa][Ll]) echo -en "" ;; *) tput sgr0 ;; esac } function normal { tput sgr0 } function computershack { echo -en "" } function fgbg { echo -en "" } echo -n "This is in " setfg red echo -n red setfg normal echo -n ", white, and " setfg blue echo -n blue setfg normal echo . echo clean line setfg green setbg grey echo -n "How about this?" setbg black setfg white echo echo clean line echo fgbg echo "+------------------------------------------------------------------------------+" echo "| This is a giant blue box! |" echo -n "+------------------------------------------------------------------------------+" normal echo