-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
  • 209
  • 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
  • 190,037
  • 45
  • 260
  • 285
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
  • 12,994
  • 6
  • 31
  • 51
0

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

tr '[a-z]' '[A-Z]'
rjhdby
  • 1,146
  • 11
  • 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
  • 126,337
  • 18
  • 137
  • 204