[问题] 写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