Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

my target is to verify the range of number with (only with - case + esac ) , and print the range

so for example

if number is between 0-80 , case will print


or if range is between 81-100 then case will print


and so on....

the problem with my script print only >=0<=90 only if number between 0-9 ?

how to fix my script , so it will print according to number range ?


read number 

case $number in 
    [0-80])  echo ">=0<=80";; 
    [81-100]) echo ">=81<=100";; 
    [101-120]) echo ">=101<=120";;
    [121-300]) echo ">=121<=300";;
share|improve this question
add comment

1 Answer 1

up vote 0 down vote accepted

In zsh (which ksh is symlinked to on my system) you need to use <> for numerical ranges:

case $number in
    <0-80>)  echo ">=0<=80";;
    <81-100>) echo ">=81<=100";;
    <101-120>) echo ">=101<=120";;
    <121-300>) echo ">=121<=300";;
share|improve this answer
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.