#!/bin/bash total=0 count=0 while read num do total=$(( $total + $num )) count=$(( $count + 1)) done < numbers.txt echo "The average of the numbers is $(( $total / $count ))"