diff --git a/cs205_final_exam.sh b/cs205_final_exam.sh old mode 100644 new mode 100755 index d0d0d57c..c570ac10 --- a/cs205_final_exam.sh +++ b/cs205_final_exam.sh @@ -10,3 +10,15 @@ # The spacing and header formatting should match the above formatting description exactly. # There should be a comment explaining the purpose of each line in your shell script. # The data file will be passed in to the script as a positional parameter and will not necessarily be called best_pokemon.dat. However, you can assume that any file passed to this script will be formatted exactly the way best_pokemon.dat is formatted. + +#!/bin/bash +filename="$1" +echo "===== SUMMARY OF DATA FILE =====" +echo " File name: $filename" +total_pokemon=$(awk 'END {print NR}' "$filename") +echo " Total Pokemon: $total_pokemon" +avg_hp=$(awk '{total += $2} END {print total / NR}' "$filename") +echo " Avg. HP: $avg_hp" +avg_attack=$(awk '{total += $3} END {print total / NR}' "$filename") +echo " Avg. Attack: $avg_attack" +echo "===== END SUMMARY =====" diff --git a/screenshots/Screenshot from 2024-05-07 21-20-43.png b/screenshots/Screenshot from 2024-05-07 21-20-43.png new file mode 100644 index 00000000..37f0e160 Binary files /dev/null and b/screenshots/Screenshot from 2024-05-07 21-20-43.png differ