Last active
December 28, 2015 20:49
-
-
Save pygillier/7559797 to your computer and use it in GitHub Desktop.
Common Bash 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
################### | |
# Common bash functions | |
# | |
# Code derived from various sources. | |
# Use at your own risks! | |
# | |
################### | |
# Text formatting | |
e_bold () { echo -e "\e[1m$1\e[0m"; } | |
e_underline () { echo -e "\e[4m$1\e[0m"; } | |
e_reverse () { echo -e "\e[7m$1\e[0m"; } | |
bold () { return "\e[1m$1\e[0m"; } | |
underline () { return "\e[4m$1\e[0m"; } | |
reverse () { return "\e[7m$1\e[0m"; } | |
# Coloring | |
e_red () { echo -e "\e[31m$1\e[39m"; } | |
e_blue () { echo -e "\e[34m$1\e[39m"; } | |
e_green () { echo -e "\e[32m$1\e[39m"; } | |
e_yellow () { echo -e "\e[33m$1\e[39m"; } | |
red () { return "\e[31m$1\e[39m"; } | |
blue () { return "\e[34m$1\e[39m"; } | |
green () { return "\e[32m$1\e[39m"; } | |
yellow () { return "\e[33m$1\e[39m"; } | |
# Logging |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment