diff --git a/convert.zsh b/convert.zsh index 40bd088..601b2b2 100755 --- a/convert.zsh +++ b/convert.zsh @@ -5,6 +5,7 @@ echo "Paste the full list of names (one name per line), then press Enter and Ctr names=$(>"$absent_file" - echo "Marked $student as absent" - break - ;; - p) - echo "$student" >>"$present_file" - echo "Marked $student as present" - break - ;; - r) - echo "Repeating $student's name" - speak_student "$student" - ;; - *) - echo "Invalid option. Use 'a' for absent, 'p' for present, 'r' to repeat." - ;; - esac - done - echo "" + speak_student "$student" # Speak the student's name + + echo "Mark attendance for $student: (a for absent, p for present, r to repeat)" + while true; do + read -n 1 -s choice # Read a single character for attendance input + case "$choice" in + a) + echo "$student" >>"$absent_file" # Mark as absent + echo "Marked $student as absent" + break + ;; + p) + echo "$student" >>"$present_file" # Mark as present + echo "Marked $student as present" + break + ;; + r) + echo "Repeating $student's name" + speak_student "$student" # Repeat the student's name + ;; + *) + echo "Invalid option. Use 'a' for absent, 'p' for present, 'r' to repeat." + ;; + esac + done + echo "" done +# Display attendance summary echo "Attendance completed!" echo -e "Present students: \n$(cat $present_file)\n" echo "--------------------------"