【发布时间】:2020-10-13 06:42:15
【问题描述】:
例如:
#!/bin/bash
printf '%s' "write 4 numbers separated by spaces:"
read -r var
# suppose to print sum of calculated numbers, in this case I want to calculate like this:
# ((1n*2n)+(3n*4n))/2 <----divided by (total item/2)
exit 0
所以,假设我们在执行代码时输入了 4 个数字,让我们输入11 22 33 44.4,然后输入enter,然后如果我没记错的话,我们得到853.6。
【问题讨论】:
标签: printf echo user-input calc