I am reading a character from keyboard and converting it to uppercase and then displaying the character again.
But the following code produces an error:
read a;
a=echo $a | tr 'a-z' 'A-Z'
echo $a
I also tried this:
read option;
eval $(awk -v option=$option '{print "a="toupper(option);}')
echo $a
If you want to store the result of a
back in a
, then you can do use command substitution:
read a;
a=$(echo $a | tr 'a-z' 'A-Z')
echo $a