1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15:
#!/bin/bash SUM=0 ELEMENTS=0 AVG=0 cat myFile | while read line; do if [ -n "$line" ]; then let ELEMENTS++; let SUM=$SUM + $line # let SUM+=$line?? not sure fi done let AVG=$SUM/$ELEMENTS echo $AVG