Advertisement
Guest User

BMI

a guest
Feb 19th, 2022
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.49 KB | None | 0 0
  1. read -p "How about your Height(cm)?" height
  2. read -p "How about your Weight(kg)?" weight
  3.  
  4. echo "your height is $height cm"
  5. echo "your weight is $weight kg"
  6.  
  7. BMI=`echo "$height $weight" | awk '{print $2/(($1/100)*($1/100))}'`
  8.  
  9. echo "---------Result---------"
  10.  
  11. bash bbb.sh ${BMI}
  12.  
  13.  
  14.  
  15.  
  16.  
  17. > ls
  18. bbb.sh  main.sh
  19.  
  20. > bash main.sh
  21. How about your Height(cm)?168
  22. How about your Weight(kg)?52
  23. your height is 168 cm
  24. your weight is 52 kg
  25. ---------Result---------
  26. “your bmi is 18.424
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement