Skip to content

Instantly share code, notes, and snippets.

@glallen01
Created October 23, 2019 10:06
Show Gist options
  • Save glallen01/bc1d24bb5ccacd48b6634513a8a0cbdb to your computer and use it in GitHub Desktop.
Save glallen01/bc1d24bb5ccacd48b6634513a8a0cbdb to your computer and use it in GitHub Desktop.
shell ansi functions
# from http://shallowsky.com/blog/linux/html-mail-in-mutt.html
echo -e "\e[1mbold\e[0m"
echo -e "\e[3mitalic\e[0m"
echo -e "\e[4munderline\e[0m"
echo -e "\e[9mstrikethrough\e[0m"
echo -e "\e[31mHello World\e[0m"
echo -e "\x1B[31mHello World\e[0m"
ansi() { echo -e "\e[${1}m${*:2}\e[0m"; }
bold() { ansi 1 "$@"; }
italic() { ansi 3 "$@"; }
underline() { ansi 4 "$@"; }
strikethrough() { ansi 9 "$@"; }
red() { ansi 31 "$@"; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment