I have a variable defined a12. Wanted to convert this variable to upper case and assign it to another varialble
*IT IS A .tn script with the script header includer --- > #!/bin/tn_shell*
Please help me in solving this .
I have a variable defined a12. Wanted to convert this variable to upper case and assign it to another varialble
*IT IS A .tn script with the script header includer --- > #!/bin/tn_shell*
Please help me in solving this .
Assuming tn_shell
is a bourne like shell, you can probably do:
a13=$( echo "$a12" | tr a-z A-Z )
or
a13=$( echo "$a12" | tr [:lower:] [:upper:] )
a="$(tr [a-z] [A-Z] <<< "$a")"
bash-3.2$echo lower to upper | tr '[:lower:]' '[:upper:]'
LOWER TO UPPER
To Save in the variable use below
var=$(echo lower to upper | tr '[:lower:]' '[:upper:]')
Madre mia. I need write this text because post's minimum is 30 characters
tr '[a-z]' '[A-Z]'
To turn a string into upper case, use string toupper
. That returns a copy of the input string (with the case transformation applied, of course) that you can then assign to wherever you want.
set a13 [string toupper $a12]