Shell Script Tip : Case conversion

How to convert user input to a single case upper/lower for easy comparison?

Option 1: Use tr command

bash-3.00$ echo “unni” | tr ‘[a-z]‘ ‘[A-Z]‘
UNNI

Option 2: If you are using korn shell, use typeset command
#!/usr/bin/ksh

typeset -u VAR1
VAR1=”True”
echo $VAR1

Leave a Comment