Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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

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.