Case statement not working as expected

            case "$freq" in
            [2,2.5,3.15,4,5,6.3]" Hz")          low=250; high=550;;
            "8 Hz")                             low=250; high=1000;;
            [10,12.5,16,20,25,31.5,40,50]" Hz") low=400; high=1000;;
            "63 Hz")                            low=550; high=1000;;
            [80,100,125,160,200,250]" Hz")      low=400; high=550;;
            *)                                  low=error; high=error;;
            esac

The strings containing decimal places like "6.3 Hz" are not being found in the case statement. I have tried putting "6.3" or '6.3' around the individual entries.

Can someone explain what is going on here?

Mike

The syntax is not correct ( [..] denote a single character that can be any of the characters specified inside them). Try:

  case ${freq% Hz} in
    2|2.5|3.15|4|5|6.3)  ...
1 Like

Will do, thanks.

Mike

edit: works fine