The shell script for loan calculation aims to further understand mathematical computing in terms of temperature conversion. Code: 01 #! /Bin/sh02 03 # loancalc. sh -- specify the loan principal, tax rate, and period 04 05 # formula: M = P * (J/(1-(1 + J) **-N) 06 # where, P = Principal, J = monthly tax rate, N = years (months) 07 # user input P, I (annual interest rate), L (length, year) 08 09 # note, the (1 + J) **-N behind the formula is a whole, indicating the index 10 # For example, (1 + 1) **-2 is 2 ^-2, equivalent to 1/2*2 = 0.2511 12 # source library. sh13 14if [$ #-ne 3]; then15 echo "Usage: 'basename $ 0' principal interest loan-duration-years"> & 216 exit 117fi18 19 # scriptbc used here. sh is the ninth script of the Program 2 0 # The parameter passed to it is a formula, and some operator numbers need to be escaped. 21 # Escape :() * ^ 22 P = $1 I = $2 L = $ 323J = "$ (scriptbc. sh-p 8 $ I/\ (12 \ * 100 \) "24N =" $ ($ L * 12) "25 M =" $ (scriptbc. sh-p 8 $ P \ * \ ($ J/\ (1-\ (1 + $ J \) \ ^-$ N \)\)) "26 27 dollars =" $ (echo $ M | cut-d. -f1) "28 cents =" $ (echo $ M | cut-d. -f2 | cut-C1-2) "29 30 # newnicenum. sh is the 31cat program in the 4th scripts <EOF32A $ L year loan at $ I % interest with a principal amount of $ (newnicenum. sh $ P 1) 33 results in a payme Nt of \ $ dollars. $ cents each month for the duration of34the loan ($ N payments ). 35EOF36 37 exit 0 running result: 1 $ loancalc 40000 6.75 42A 4 year loan at 6.75% interest with a principal amount of 953.21 results in a payment of $ each month for the duration of4the loan (48 payments ). 5 6 $ loancalc 40000 6.75 57A 5 year loan at 6.75% interest with a principal amount of 787.33 results in a payment of $ Each month for the duration of9the loan (60 payments). Analysis Script: This script shows a complete mathematical formula operation.