All uncontrolled byte sequences of your script output to the terminal are interpreted for display in accordance with the terminal settings. If you configure it to interpret the input as utf-8 , then all you need to do in the bash script prints the Celsius character, as utf-8 requires .
Setting the right to the terminal depends on the application you are using. It is likely that it is already in utf-8 mode.
To display the character you need, you need to find its Unicode encoding code and encode it in utf-8, or you can find it somewhere where the utf-8 character sequence is already shown. The Celsius symbol is described here , for example.
celsius utf-8 0xE2 0x84 0x83, $'string', escape \xhh:
$ echo $'\xe2\x84\x83'
℃
-e:
$ echo -e '\xe2\x84\x83'
℃
,
$ CEL=$'\xe2\x84\x83'
$ echo $CEL
℃
℃ : C, :
$ echo $'\xc2\xb0'C
°C
, $'string', , perl python:
$ python -c 'print "\xe2\x84\x83"'
℃
$ perl -e 'print "\xe2\x84\x83\n"'
℃
GNU awk escape- C, \xhh, :
$ awk 'BEGIN { print "\xe2\x84\x83"; }'
℃
$ awk 'BEGIN { print "\xc2\xb0\C"; }'
°C
, ( escape- , C, . GNU awk).
awk - . 0xC2 302 0xB0 260, :
$ awk 'BEGIN { print "\302\260C"; }'
°C
,
$ awk 'BEGIN { print "\342\204\203"; }'
℃