Created
April 14, 2020 09:38
-
-
Save marco-m/ff87192de901fea27b4d2f53488958f6 to your computer and use it in GitHub Desktop.
nice simple way to use colors in shell 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
#! /bin/bash | |
# Courtesy of https://github.com/thought-machine/please/blob/master/bootstrap.sh | |
# See for example http://man7.org/linux/man-pages/man4/console_codes.4.html | |
# for more ANSI colors | |
function notice { | |
>&2 echo -e "\033[32m$1\033[0m" | |
} | |
function warn { | |
>&2 echo -e "\033[33m$1\033[0m" | |
} | |
# example usage | |
# note: requires the arguments to be quoted so that it becomes only 1 | |
notice "as a notice: Building Please..." | |
warn "as a warn: Building Please..." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment