IF loop syntax error

I am trying to run a menu option though IF loops. I keep getting errors not allowed the menu to be processed correctly. Currently it will accept the first 2 statements but then crash on the 3rd. The 2nd and 3rd have the same syntax, so I do not understand why it breaks.

#!/bin/bash

while true; do

    read -p "Enter project number (1/2/3/10/20/30):"
    $menu
    
    if [ $menu -eq 1 ]; then
    {    
    echo "1"
    }
    elif [ $menu -eq 2 ]; then
    {
    echo "2"
    {
    elif [ $menu -eq 3 ]; then
    {
    echo "3"
    {
    elif [ "$menu" == "10" ]; then
    {
    echo "10"
    {
    elif [ "$menu" == "20" ]; then
    {
    echo "20"
    {
    elif [ "$menu" == "30" ]; then
    {
    echo "30"
    {    
    fi

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

The first read does not populate $menu because it should not have the dollar character (the second read looks ok).
Also there are rather a lot of left braces { and no right braces.

However, this sort of script is best achieved with a case statement similar to your second read and then would be much easier to read:

#!/bin/bash

while true; do

    read -p "Enter project number (1/2/3/10/20/30):" menu
    case "${menu}" in
          1) echo "${menu}"
               ;;
          2) echo "${menu}"
               ;;
          3) echo "${menu}"
               ;;
          10) echo "${menu}"
               ;;
          20) echo "${menu}"
               ;;
          30) echo "${menu}"
               ;;
          *)  echo "Invalid option: ${menu}"
               ;;
    esac

    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

Thank you, I feel kinda dumb not noticing all the brackets were wrong :wall:

I'ce removed my comment about then because I had a moments word blindness. Some people us a different layout.

Actually, there was no need for braces at all, this is shell after all.

    if   [ "$menu" -eq  1 ]; then
      echo "1"
    elif [ "$menu" -eq  2 ]; then
      echo "2"
    elif [ "$menu" -eq  3 ]; then
      echo "3"
    elif [ "$menu" -eq 10 ]; then
      echo "10"
    elif [ "$menu" -eq 20 ]; then
      echo "20"
    elif [ "$menu" -eq 30 ]; then
      echo "30"
    else
      echo "Invalid option: $menu"
    fi

But I agree a case statement is better suited...

case $menu in  
  1|2|3|10|20|30) echo "$menu" ;; 
  *) echo "Invalid option: $menu" ;; 
esac