linux - Copyright and pound sterling symbol in Bash script -
what proper way of inserting copyright symbol © , pound sterling symbol £ bash script.
i using nano editor , running debian squeeze.
if copy , paste symbol windows, works seems paste hidden characters nano cannot display , makes hard edit code in shell script then.
so example want able this:-
text="£15.00" text2="© john doe"
it seems using locale doesn't support these symbols (in olden days have been bad font). since using utf-8 characters (default on windows), need in utf-8 aware environment on linux. can check locale command:
$ locale lang=en_us.utf-8 lc_ctype="en_us.utf-8" lc_numeric="en_us.utf-8" lc_time="en_us.utf-8" lc_collate="en_us.utf-8" lc_monetary="en_us.utf-8" lc_messages="en_us.utf-8" lc_paper="en_us.utf-8" lc_name="en_us.utf-8" lc_address="en_us.utf-8" lc_telephone="en_us.utf-8" lc_measurement="en_us.utf-8" lc_identification="en_us.utf-8" lc_all= so system fine, yours had default, ascii c locale set. these simple bash variables, export them individually or override them (by setting lc_all). however, affect current shell, need make part of shell initialisation work everytime automatically.
this done through profile scripts in /etc globally, .bash_profile or .bashrc work well. in version of debian locale stored in /etc/default/locale , can list of available choices locale -a, eg.:
$ locale -a c en_us en_us.iso88591 en_us.utf8 posix sl_si.utf8 pick 1 utf8 suffix. if need other locales (for example japanese), can generated localedef/locale-gen (comes glibc or separate package).
Comments
Post a Comment