I tried to convert a lowercase string to uppercase and assign it to a variable using the following code
The script is written in .tn extension
As @anubhava mentioned, if anyone is looking to convert a string to lower case using a native way
$ str="BASH"
$ echo ${str,,}
bash
This should work:
$ y="Foo Bar Baz"
$ y_up=$(tr '[A-Z]' '[a-z]' <<< $y)
$ echo $y_up
foo bar baz
BASH 4+ version has native way to convert sting to upper case:
upperStr="${str^^}"
Below Works, Try this.
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:]')