Skip to content

Instantly share code, notes, and snippets.

@mminer
Created December 10, 2019 18:04
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 mminer/708947684fbd7c4bf2857c06800f6826 to your computer and use it in GitHub Desktop.
Save mminer/708947684fbd7c4bf2857c06800f6826 to your computer and use it in GitHub Desktop.
Basic Bash script to test equality of two inputs with coloured output.
#!/usr/bin/env bash
actual=$1
expected=$2
# https://stackoverflow.com/a/5947802
GREEN='\033[0;32m'
RED='\033[0;31m'
RESET='\033[0m' # No Color
test "$actual" = "$expected" \
&& echo -e "${GREEN}PASS${RESET}" \
|| echo -e "${RED}FAIL${RESET}; received $actual, expected $expected"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment