function SUN_swap_mon { ############# CAPTURE AND PROCESS THE DATA ################ # Use two awk statements to extract the $9 and $11 fields # from the swap -s command output SW_USED=$(swap -s | awk '{print $9}' | cut -dk -f1) SW_FREE=$(swap -s | awk '{print $11}' | cut -dk -f1) # Add SW_USED to SW_FREE to get the total swap space ((SW_TOTAL = SW_USED + SW_FREE)) # Calculate the percent used and percent free using the # bc utility in a here documentation with command substitution PERCENT_USED=$(bc <