I don't know why, but I find this idea to be unusually cool... A Bash script for computing my BMI? I never thought of using Bash to implement a solution like this, it's fun. 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. If I have time this week, I might do that. I'll send it back out to the list if I do. Thanks! -> Jake On Tue, May 8, 2012 at 2:14 AM, Mike Miller <mbmiller+l at gmail.com> wrote: > See my one-liner below, with documentation. > > 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. > > 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.) > > 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. > > Mike > > > ---------------begin script on next line---------------- > #!/bin/bash > > # Computes your Body Mass Index (BMI) from height > # in inches and weight in pounds > # > # Syntax: > # > # bmi num1 num2 > # # where num1 is height in inches and > # num2 is weight in pounds > # > # http://www.nhlbisupport.com/**bmi/ <http://www.nhlbisupport.com/bmi/> > # > # Underweight = <18.5 > # Normal weight = 18.5–24.9 > # Overweight = 25–29.9 > # Obese = > 30 > > > echo $1 $2 | awk '{printf("%.1f kg/m²", 703.06958*$2/$1^2)}' > --------------end script on previous line--------------- > _______________________________________________ > TCLUG Mailing List - Minneapolis/St. Paul, Minnesota > tclug-list at mn-linux.org > http://mailman.mn-linux.org/mailman/listinfo/tclug-list > > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mailman.mn-linux.org/pipermail/tclug-list/attachments/20120508/740277dd/attachment-0001.html>