Posted by: Gangadhar on: March 26, 2009
Have you ever wondered why there is no toUpper() kind of function in shell script? Well, i think the reason is typeset command.
What does it do exactly? A lot:
* Set a parameter as an integer by using -i option so as to fasten the arithmetic operations on that variable.
* Convert to lower case using -l
* Mark a variable as Read-only using -r
etc…
Converting into upper case? Yes, you guessed it right, use -u option.
How to use it? You can use it before assignment or after assignment, does not make much difference.
Whats more? You can even give more that one variable to this typeset command.
For more information on typeset, use man typeset.