Skip to content

Instantly share code, notes, and snippets.

@bupy7
Last active January 30, 2024 07:15
Show Gist options
  • Save bupy7/8de1b2134ec63a19ee441a25a24102d4 to your computer and use it in GitHub Desktop.
Save bupy7/8de1b2134ec63a19ee441a25a24102d4 to your computer and use it in GitHub Desktop.
Bash/Shell coloring
#!/usr/bin/env bash
BOLD="$(tput bold)"
UNDERLINE="$(tput smul)"
STANDOUT="$(tput smso)"
NONE="$(tput sgr0)"
BLACK="$(tput setaf 0)"
RED="$(tput setaf 1)"
GREEN="$(tput setaf 2)"
YELLOW="$(tput setaf 3)"
BLUE="$(tput setaf 4)"
PURPLE="$(tput setaf 5)"
CYAN="$(tput setaf 6)"
WHITE="$(tput setaf 7)"
print() {
if [ $# -gt 1 ]; then
echo $2$1$NONE
tput sgr0
else
echo $1
fi
}
print "Mazafaka" $PURPLE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment