Created
October 23, 2019 10:06
-
-
Save glallen01/bc1d24bb5ccacd48b6634513a8a0cbdb to your computer and use it in GitHub Desktop.
shell ansi functions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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