Created
July 16, 2012 14:30
-
-
Save alessandro-fazzi/3123047 to your computer and use it in GitHub Desktop.
colorize bash script's user interactive messages. These are helper functions for scripts
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
# Text color variables | |
txtred=$(tput setaf 1) #Red | |
txtgre=$(tput setaf 2) # Green | |
txtyel=$(tput setaf 3) # Yellow | |
txtblu=$(tput setaf 4) # Blue | |
txtbol=$(tput bold) # Bold | |
txtres=$(tput sgr0) # Reset | |
# Helper feedback functions | |
function info() { | |
echo "${txtbol} * ${1}${txtres}" | |
} | |
function success() { | |
echo "${txtbol}${txtgre} ** ${1}${txtres}" | |
} | |
function warning() { | |
echo "${txtbol}${txtyel} *** ${1}${txtres}" | |
} | |
function error() { | |
echo "${txtbol}${txtred} **** ${1}${txtres}" | |
} | |
function question() { | |
echo -n "${txtbol}${txtblu} ? ${1}?${txtres} " | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment