Skip to content

Instantly share code, notes, and snippets.

@joshspicer
Last active May 23, 2019 14:38
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 joshspicer/d0aa8aaf88fae78625328dcdc54415e2 to your computer and use it in GitHub Desktop.
Save joshspicer/d0aa8aaf88fae78625328dcdc54415e2 to your computer and use it in GitHub Desktop.
#!/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