Last active
May 23, 2019 14:38
-
-
Save joshspicer/d0aa8aaf88fae78625328dcdc54415e2 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
################## | |
NUM_ARGS=1 | |
RED='\033[0;31m' | |
YELLOW='\033[0;33m' | |
NC='\033[0m' # No Color | |
################## | |
# Check for correct number of arguments | |
if [ "$#" -ne $NUM_ARGS ]; then | |
echo "[-] Usage: ./quick-bash-program.sh <arg0>" | |
exit 1 | |
fi | |
# Case Switch on First Arg | |
case $1 in | |
'case1' ) | |
echo -e "${RED}Case1 hit${NC}" ;; | |
'case2' ) | |
echo -e "${YELLOW}Case2 hit${NC}" ;; | |
* ) | |
echo "No Case hit. Exiting," | |
exit 1 | |
;; | |
esac | |
# Ask for user confirmation | |
read -p "[+] Ask a Question here. Are you sure? (Y) " -n 1 -r | |
echo | |
# If (Y) from user. | |
if [[ $REPLY =~ ^[Yy]$ ]] | |
then | |
echo "TODO: Put actual program here." | |
else | |
echo "[-] Program Canceled" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment