[問題] 寫shell script遇到問題

作者: shinyu0816 (shinyu)   2022-02-18 09:19:14
我寫了一隻計算bmi並傳值到另一支程式印出結果的ss.
read -p "How about your Height(cm)?" height
read -p "How about your Weight(kg)?" weight
echo "your height is $height cm"
echo "your weight is $weight kg"
#because i need chage height's cm to m, and 1m = 100cm
h=`expr $height / 100`
BMI=`expr $weight / ($h \* $h)`
echo "
作者: roccqqck (ccqq)   2022-02-18 09:21:00
不同shell吧或bash版本不同
作者: bitlife (BIT一生)   2022-02-18 09:28:00
把呼叫 bash 那行改成直接印出 BMI, 先確認問題在哪邊
作者: brli7848 (無理阿?)   2022-02-18 11:10:00
放root心臟不錯喔
作者: fuyuanli (FuYuan)   2022-02-18 23:47:00
#!/bin/bash or #!/bin/sh
作者: holishing   2022-02-18 23:55:00
說不定人家是先開 docker 再放裡面的 /root 啊 (
作者: OSDBNetwork (路人甲)   2022-02-20 02:28:00

Links booklink

Contact Us: admin [ a t ] ucptt.com