Tuesday, June 18, 2013

Bash command to convert string in variable to uppercase


Suppose you have a variable MY_VAR with value: 

MY_VAR="this is my test"

To convert it to uppercase simply use the ^^. For e.g.,  

echo ${MY_VAR^^}

This will output: THIS IS MY TEST

No comments:

Post a Comment