Skip to content

Instantly share code, notes, and snippets.

@tmbritton
Created January 10, 2014 15:57
Show Gist options
  • Save tmbritton/8356953 to your computer and use it in GitHub Desktop.
Save tmbritton/8356953 to your computer and use it in GitHub Desktop.
Quarterly bonus calculator
#!/bin/bash
#
# Bonus Calculator for WFM quarterly bonuses
read -p "What is your hourly rate? " rate
read -p "Is this a 12 or 16 week period? " weeks
read -p "What is your bonus percentage? (whole integer, not decimal) " percent
bonus=$(echo "$rate * 40 * $weeks * .$percent" | bc)
echo "Your full bonus is: $bonus"
read -p "Would you like to find a percentage of this total? (y/n)?"
if [ $REPLY == "y" ]; then
read -p "What percentage would you like to find? (whole integer, not decimal) " percentage
out=$(echo "$bonus * .$percentage" | bc)
echo "The grand total is: $out"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment