Created
August 6, 2021 06:01
-
-
Save benprew/7ae8fae988b04ed6bcae1c66287c2944 to your computer and use it in GitHub Desktop.
bodyfat calculator
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
#!/bin/bash | |
height=$1 | |
neck=$2 | |
abdomen=$3 | |
if [[ -z $height || -z $neck || -z $abdomen ]]; then | |
echo "$0 - calculate your bodyfat using the US Navy method" | |
echo "Usage: $0 <height> <neck> <abdomen>" | |
echo " height - height (in inches)" | |
echo " neck - neck diameter (in inches, just above adam's apple)" | |
echo " waist - waist diameter (in inches, narrowest point)" | |
exit 1 | |
fi | |
bodyfat=$(echo "86.010 * (l($abdomen - $neck)/l(10)) - 70.041 * (l($height)/l(10)) + 36.76" | bc -l) | |
printf "bodyfat: %0.0f%%" $bodyfat |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
they take the average of the set of measurements then use that to calculate it. and they measure your neck, then you stomach, then you neck and so forth.
also considering how much you normally work out. i wouldn't put a lot of faith in it for giving you a decent level of exactness.