Skip to content

Instantly share code, notes, and snippets.

@Androguide
Last active January 4, 2016 02:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Androguide/8556766 to your computer and use it in GitHub Desktop.
Save Androguide/8556766 to your computer and use it in GitHub Desktop.
Bash boilerplate for coloured scripts and checking for passed arguments
#!/bin/bash
CYAN="\\033[1;36m"
GREEN="\\033[1;32m"
YELLOW="\\E[33;44m"
RED="\\033[1;31m"
RESET="\\e[0m"
MODE='blah'
if [ -z "$1" ]
then
echo -n -e "\n${RED}*** NO ARGUMENTS SPECIFIED! ***${RESET}\n\n"
echo -n -e "${CYAN}Please input desired runmode for the build ${YELLOW}(test / prod)${RESET}${CYAN} : ${RESET}"
read runmode
MODE=$runmode
else
MODE=$1
fi
echo -n -e "\n${CYAN}Building `basename "$PWD"` in ${YELLOW}${MODE}${RESET}${CYAN} mode...${RESET}\n"
RUNMODE=$MODE make build
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment