Skip to content

Instantly share code, notes, and snippets.

@stevermeister
Last active December 16, 2015 19:59
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 stevermeister/62121ddbaf7925619b03 to your computer and use it in GitHub Desktop.
Save stevermeister/62121ddbaf7925619b03 to your computer and use it in GitHub Desktop.
#!/bin/sh
BANG="echo test"
while getopts :c OPT; do
case $OPT in
c|+c)
#Chicken mode engaged! Non-root execution allowed.
BANG="echo chicken!"
chicken=1
;;
*)
echo "usage: ${0##*/} [-c]"
exit 2
esac
done
shift $(( OPTIND - 1 ))
OPTIND=1
if [[ $(whoami) != "root" && -z $chicken ]]; then
echo You are a chicken for playing this game while not root!
exit 1
fi
[ $[ $RANDOM % 6 ] == 0 ] && $BANG || echo *Click*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment