Just want to share the final code: https://gist.github.com/zaydek/1627329f88c444f6d71d5cbc0cda616f :)
function enc {
a=${1: -3:1}; b=${1: -2:1}; c=${1: -1}
d=${2: -3:1}; e=${2: -2:1}; f=${2: -1}
if (( $[a] < $[d] )); then
if (( $b$c == 00 && $e$f == 99 )); then echo [$a-$d][0-9][0-9]
elif (( $b$c == 00 )); then if (( $[a+1] < $d )); then echo [$a-$[d-1]][0-9][0-9] "|"; echo $(enc $[d]00 $d$e$f)
else echo $a[0-9][0-9] "|"; echo $(enc $[a+1]00 $d$e$f); fi
else echo $(enc $a$b$c $[a]99) "|"; echo $(enc $[a+1]00 $d$e$f); fi
elif (( $b < $e )); then
if (( $c == 0 && $f == 9 )); then echo $a[$b-$e][0-9]
elif (( $c == 0 )); then if (( $[b+1] < $e )); then echo $a[$b-$[e-1]][0-9] "|"; echo $(enc $a$[e]0 $d$e$f)
else echo $a$b[0-9] "|"; echo $(enc $a$[e]0 $d$e$f); fi
else echo $(enc $a$b$c $a$[b]9) "|"; echo $(enc $a$[b+1]0 $d$e$f); fi
else
if (( $c == $f )); then echo $a$b$c
else echo $a$b[$c-$f]; fi; fi
}
function int {
if [[ $1 = *.* ]]; then
integer=${1%.*}
decimal=${1#*.}
if (( ${decimal:0:1} >= 5 )); then integer=$[integer+1]; fi
echo $integer
else echo $1; fi
}
function cse {
minimum=$(int $(echo $1 $2 | awk '{ print ($1/$2)*( 90) }'))
maximum=$(int $(echo $1 $2 | awk '{ print ($1/$2)*(110) }'))
echo $(enc $minimum $maximum)
}
cse $1 $2
cse , , .. 90 110 -10% + 10%, minimum maximum enc, , case ( ).
: bash, , case, . 2 3 , .
user3054109