greater than less than in case

Hi ,

I want to do the following:

i=6
case $i in
        -lt 10)
                echo Period=10
                ;;
        -gt 10 && -lt 15)
                echo Period-15
                ;;
        >15 && <20)
                echo Period=20
                ;;
        >20 && <30)
                echo Period=30
                ;;
        >30 && <60)
                echo Period=60
                ;;
        *)
                echo Period*
                ;;
esac

But it doesnt work ...i get a syntax error ...shud i go for "if" ...can somebody help pls ...

You could do something like this:


case $i in
        [0-9])
                echo Period=10
                ;;
        1[0-5])
                echo Period-15
                ;;
        1[6-9])
                echo Period=20
                ;;
        2[0-9])
                echo Period=30
                ;;
        [3-5][0-9])
                echo Period=60
                ;;
        *)
                echo Period*
                ;;
esac

That worked !!!
thanks