Skip to content

Instantly share code, notes, and snippets.

@jcbagtas
Created November 27, 2020 07:58
Show Gist options
  • Save jcbagtas/411052b96a15c5c36ba4557d912cc786 to your computer and use it in GitHub Desktop.
Save jcbagtas/411052b96a15c5c36ba4557d912cc786 to your computer and use it in GitHub Desktop.
Create a Bannered Text that demands attention.
## EMBED THIS FUNCTION INSIDE YOUR BASH FILE
banner () {
case $3 in
RED)COLOR='\033[0;31m'
;;CYAN)COLOR='\033[0;36m'
;;GREEN)COLOR='\033[0;32m'
;;LGREEN)COLOR='\033[1;32m'
;;PURPLE)COLOR='\033[0;35m'
;;BROWN)COLOR='\033[0;33m'
;;*)
COLOR='\033[0m'
;;esac
NC='\033[0m'
message="$2 $1 $2"
mlength=${#message}
banner="$(printf "$2%.0s" $(seq 1 $mlength))"
if [ ${#banner} -gt 0 ]
then
banner="\n$banner\n"
fi
printf "${COLOR}$banner$message$banner${NC}\n"
}
## USAGE
banner "SUCCESS: YOU HAVE CREATED A BANNERED TEXT" "#" "GREEN"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment