突然发现不会算术了,数学公式忘了,结果偷懒搞了下,希望高手给点意见!
#!/bin/bash
COUNT=`cal|awk 'NR==7 {print $NF}'`
read -p "input all of STAGE:" STAGE
read -p "input enchashment:" SUMALL
for i in `seq 1 $STAGE`
do
echo "#########################################"
echo -e "THIS IS THE \033[033;40m${i}TH\033[0m TIME AND DETAILS"
echo "#########################################"
NEXT_SUMALL=`awk "BEGIN{print $SUMALL*(0.9**($i-1))}"`
echo -e "REMAIN FUND : " "\033[033;40m$NEXT_SUMALL\033[0m"
ACCRUAL=`awk "BEGIN{print $NEXT_SUMALL*0.0005*$COUNT}"`
echo -e "CURRENT PERIOD ACCRUAL: " "\033[033;40m$ACCRUAL\033[0m"
if [[ "$i" == "1" ]];then
CURRENT=`awk "BEGIN{print $NEXT_SUMALL+$ACCRUAL+$NEXT_SUMALL*0.01}"`
echo -e "the $i months is " "\033[033;40m$CURRENT\033[0m"
elif [[ "$i" > "1" ]];then
CURRENT=`awk "BEGIN{print $ACCRUAL+$NEXT_SUMALL}"`
echo -e "the $i months is " "\033[033;40m$CURRENT\033[0m"
else
exit
fi
done
阅读(1501) | 评论(0) | 转发(0) |