Skip to content

Instantly share code, notes, and snippets.

@HexagonWin
Created July 29, 2021 11:59
Show Gist options
  • Save HexagonWin/873e699d3c3c09a4e7c3e09cf0bb6fad to your computer and use it in GitHub Desktop.
Save HexagonWin/873e699d3c3c09a4e7c3e09cf0bb6fad to your computer and use it in GitHub Desktop.
Sample template for me when making bash scripts
#!/bin/bash
## THIS SOFTWARE IS FREE SOFTWARE LICENSED UNDER THE GNU GPL V3
## CONFIGURATION
export A2PRG_VER=0
export A2PRG_SCRPT=Sample
# COLOR SETUP
RED='\033[0;31m'
NC='\033[0m'
LG='\033[0;37m'
PA='\033[0;36m'
YEL='\033[1;33m'
GRE='\033[1;32m'
PUR='\033[1;35m'
# INIT
echo "You ran $A2PRG_SCRIPT Version $A2PRG_VER : Executable name $0"
echo "Target ? - t"
case "$0" in
*\ * )
echo -e "${RED}✗ ERROR: File name contains spaces. Rename and try again.${NC}"
exit
;;
*)
echo -e "${GRE}✓ OK: Problem detection mechanism passed!"
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment