Case insensitive comparison of strings

Hi All,

In one shell script I have

In variable "i" I am getting a full path of a file. Now I want to compare something like

-- upper(*Nav*))

I dont want to do like below because in each CASE statement I doing so many operations.

Please guide me.

Thanks in advance
Vishalaksha

you can use several ways, as

*Nav*)
*nav*)
;;

or

convert the input to upper case and then use it: TECHPULP | Bash shell script to convert string from lower to upper case and vice versa

Perhaps you could do this

case "$i" in
*[nN][aA][vV]*)
;;
esac

You can use also "or"

case "$some" in
   *Nav*|*NAV*|*nav*) ... ;;
# or
    *[nN]av*|*NAV*) ... ;;
# or ...
esac

In ksh you can use typeset

a="$i"
# set lower (-u = upper)
typeset -l a
case "$a" in
   *nav*) ... ;;
esac

If you are using bash, then

shopt -s nocasematch
case "$i" in
   *nav*) ... ;;
esac

tr is also solution, but it's not builtin command as previous.

Thanks Vino and Kshji for providing help.
*[nN][aA][vV]*) is working for me.....