linux-tutorial/codes/shell/基本脚本/使用内联重定向计算表达式.sh

16 lines
183 B
Bash
Raw Normal View History

2019-10-29 18:22:19 +08:00
#!/usr/bin/env bash
2019-05-10 11:17:57 +08:00
var1=10.45
var2=43.67
var3=33.2
var4=71
2019-10-10 08:56:31 +08:00
var5=`bc << EOF
2019-05-10 11:17:57 +08:00
scale=4
a1 = $var1 * $var2
b1 = $var3 * $var4
a1 + b1
EOF
`
echo The final answer for this mess is $var5