My switch case is not working properly. When I press 6 or 'r' it prints out all the names of the project and the error message.
#!/bin/bash
while true; do
read -p "Enter project number (1/2/3/10/20/30):" menu
#grabs the informations of the project number and stores it into a menu
case "${menu}" in
1) awk -F ":" '/'$menu:'/ {print "Project Name: ", $1}' project.txt
;;
2) awk -F ":" '/'$menu:'/ {print "Project Name: ", $1}' project.txt
;;
3) awk -F ":" '/'$menu:'/ {print "Project Name: ", $1}' project.txt
;;
10) awk -F ":" '/'$menu:'/ {print "Project Name: ", $1}' project.txt
;;
20) awk -F ":" '/'$menu:'/ {print "Project Name: ", $1}' project.txt
;;
30) awk -F ":" '/'$menu:'/ {print "Project Name: ", $1}' project.txt
;;
*) echo "No project exists with the given project number: ${menu}"
;;
esac
var2=$(awk -F ":" '/'$menu:'/ {print $4}' project.txt)
var3=$(awk -F ":" '/':$var2:'/ {print $3}' department.txt)
cut -d ":" -f 1-4 employee.txt > temp.txt
awk -F ":" '/'$var3'/ {print "Managers Name: ", $1,$2,$3}' temp.txt
/bin/rm temp.txt
awk -F ":" -v MEN=$menu '$2==MEN { hours += $3; } END { printf "Total Employee Hours: %.2f\n", hours }' works_on.txt
awk -F ":" -v ID=$var3 '$1==ID { count ++ } END { printf "Total number of dependents: " count "\n"}' dependent.txt
read -p "Would you like to process another project? [y/n]" yn
case $yn in
[Yy]* ) ;;
[Nn]* ) exit;;
*) echo "Please select proper entry:";;
esac
done