-2

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 .

user3304726
  • 219
  • 2
  • 4
  • 17

4 Answers4

1

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:] )
William Pursell
  • 204,365
  • 48
  • 270
  • 300
1
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:]')

Source

Like 2

Community
  • 1
  • 1
Nagaraj S
  • 13,316
  • 6
  • 32
  • 53
0

Madre mia. I need write this text because post's minimum is 30 characters

tr '[a-z]' '[A-Z]'
rjhdby
  • 1,278
  • 13
  • 15
0

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]
Donal Fellows
  • 133,037
  • 18
  • 149
  • 215