TECH SOLUTIONS

Click here to edit subtitle

Forums

Post Reply
Forum Home > Unix Learnings > Convert value of a variable to lowercase or uppercase- Shell Script

Sourav Gulati
Site Owner
Posts: 83

For example , we have a variable "check" as follows:

$ check="Unix Shell Script"

If you want to convert it into lowercase , it can be done as follows:

$ check=`echo $check | tr [:upper:] [:lower:]`

$ echo $check

unix shell script

Or if you want to convert it into uppercase , it can be done as follows:

 $ check=`echo $check | tr [:lower:] [:upper:]`

[email protected]:~$ echo $check

UNIX SHELL SCRIPT

 

 


 

 


--


January 4, 2013 at 1:01 AM Flag Quote & Reply

You must login to post.