Created
December 10, 2019 18:04
-
-
Save mminer/708947684fbd7c4bf2857c06800f6826 to your computer and use it in GitHub Desktop.
Basic Bash script to test equality of two inputs with coloured output.
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
#!/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