bash函数内部的税款计算给出错误:表达式中的语法错误

时间:2020-03-10 04:34:14

标签: linux bash floating-point

代码不起作用。我认为这可能与常量“ TAX_FACTOR = 0.0070”中的浮点有关。代码为:

ShowTax() {
           local TAX_FACTOR=0.0070
           echo "Enter the property's value."
           read propertyValue
          tax=$((expr $propertyValue*$TAX_FACTOR )) #there is a problem
          echo "The property tax is:" "$tax"      
          }

  # Main
    echo " Enter lot number of property or 0 to end"
    read lotNumber

    while(( $lotNumber != 0 ));do 
       showTax
       echo "Enter the lot number for the next property or 0 to end"
       read lotNumber
   done

0 个答案:

没有答案