I am trying to get this bash program to work but I can't seem to figure it out. I am writing this script to take a list of names and print out each names group number. I am very new to bash, so I have no idea what to do with the variable GROUPNUM in my for statement for this program to work. For example, if the users name they enter is Melissa, the program should output "Melissa, you are in group 20." I think my problem lies within my variable GROUPNUM in my for loop. Any help would be awesome, thank you.
#!/bin/bash
echo "Please enter your first name: "
read NAME
for GROUPNUM in $(NAME)
do
case $NAME in
[a-H]*) echo "$NAME, you are in group 10"
;;
[i-M]*) echo "$NAME, you are in group 20"
;;
[n-Q]*) echo "$NAME, you are in group number 30"
;;
[r-Z]*) echo "$NAME, you are in group number 40"
;;
*) echo "Please enter valid input!"
;;
esac
done
echo "Goodbye!"
$(NAME)tries to execute the commandNAME. Read the manual page and a few tutorials.case.for name in Mark Melissa Grant Jim; do ...?