I don't know why, but I find this idea to be unusually cool... <br>A Bash script for computing my BMI? I never thought of using Bash to implement a solution like this, it's fun.<br><br><blockquote style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">
I'm too lazy to write out the if/else statements to get it to tell you
if you are underweight, normal, overweight or obese, or to tell you how
many pounds you should lose.</blockquote><div>If I have time this week, I might do that. I'll send it back out to the list if I do.<br><br>Thanks!<br><br>-> Jake <br></div><br><div class="gmail_quote">On Tue, May 8, 2012 at 2:14 AM, Mike Miller <span dir="ltr"><<a href="mailto:mbmiller+l@gmail.com" target="_blank">mbmiller+l@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">See my one-liner below, with documentation.<br>
<br>
Body Mass Index, or BMI, is weight/height², but weight is in kilograms and height is in meters, so the units are kg/m². We usually measure height in feet and inches and weight in pounds, so I wrote this little script for computing BMI from height in inches and weight in pounds. I call the script "bmi". Supposedly, if your BMI exceeds 30, you are obese and if it exceeds 25, you are overweight. A lot of us sit around too much, so we are prone to gain weight and to get type-2 diabetes. Good diet and exercise are critical for prevention.<br>
<br>
I just thought you might like the little piece of awk code. I'm too lazy to write out the if/else statements to get it to tell you if you are underweight, normal, overweight or obese, or to tell you how many pounds you should lose. I might add that someday. (I'm about 9 lbs overweight.)<br>
<br>
Inevitably someone will point out that it doesn't distinguish fat mass from muscle mass, which is true. If you are unusually muscular, or the opposite, you'll want to take that into account. It turns out to correlate very well with harder-to-obtain measures of body fat.<br>
<br>
Mike<br>
<br>
<br>
---------------begin script on next line----------------<br>
#!/bin/bash<br>
<br>
# Computes your Body Mass Index (BMI) from height<br>
# in inches and weight in pounds<br>
#<br>
# Syntax:<br>
#<br>
# bmi num1 num2<br>
# # where num1 is height in inches and<br>
# num2 is weight in pounds<br>
#<br>
# <a href="http://www.nhlbisupport.com/bmi/" target="_blank">http://www.nhlbisupport.com/<u></u>bmi/</a><br>
#<br>
# Underweight = <18.5<br>
# Normal weight = 18.5–24.9<br>
# Overweight = 25–29.9<br>
# Obese = > 30<br>
<br>
<br>
echo $1 $2 | awk '{printf("%.1f kg/m²", 703.06958*$2/$1^2)}'<br>
--------------end script on previous line---------------<br>_______________________________________________<br>
TCLUG Mailing List - Minneapolis/St. Paul, Minnesota<br>
<a href="mailto:tclug-list@mn-linux.org">tclug-list@mn-linux.org</a><br>
<a href="http://mailman.mn-linux.org/mailman/listinfo/tclug-list" target="_blank">http://mailman.mn-linux.org/mailman/listinfo/tclug-list</a><br>
<br></blockquote></div><br>