我想输入一个数字,然后加税并减去折扣。
我在尝试:
#!/bin/sh
...
final_amount = $(echo "$purchase_amount+($purchase_amount * $tax)-($purchase_amount * $discount)" |bc -l)
...
但我得到:
$ . 3_purchase_amounts.sh
...
final_amount: command not found
...
请勿final_amount
在行中的“ =”字符之间加上空格:shell中的变量赋值不支持此类空格,因为这会与诸如之类的冲突command_name = arg2
。如您所见,shell尝试执行final_amount
命令,您得到了错误:
final_amount: command not found
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句