Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

FUN w/ Bash -- Happy Halloween

Programming languages, Coding, Executables, Package Creation, and Scripting.
Post Reply
Message
Author
HarborView
Posts: 41
Joined: 2014-02-01 02:21
Location: The Space Coast of the USA

FUN w/ Bash -- Happy Halloween

#1 Post by HarborView »

Seriously speaking, does the following code produce output on your screen? I've fooled around with my copy of Debian and may have some Unicode characters for math that are not standard. And if it displays in Debian in general is it likely to work in other distros.

Code: Select all

#!/bin/bash
:<<INTRO
dhm, Oct'15.
Note: The Unicode escapes are not documented in the (c) 2014 man file
which was distributed with the March 2015 GNU coreutils 8.23.
This is therefore a bug in GNU and Debian.

The undocumented syntax where xxxx or xxxxx is a hexadecimal is:

   echo -e \uxxxx       for a 4 digit hex number only (obsolete)
   echo -e \Uxxxx
   echo -e \Uxxxxx      for a 4 or 5 digit hex number

There are a bunch of "fonts" in Unicode which are not conventional fonts but
are mathematical symbols for algebra and science when the Latin and Greek 
alphabets are not enough.  

I have occasionally downloaded extra stuff for no special reasoning so I
don't know if these math symbols are default with Debian.

The current version of tr (8.23) cannot translate a Unicode sequence and I
don't know if it can even handle the accented characters of non-English
alphabets much less transliterate Greek or Cyrillic.
INTRO

declare -ar AlphaPlain=({A..Z} {a..z})
declare -r UnicodeFraktur=0x1D56C
declare -a AlphaFraktur

FrakturLoad(){
  local -i j k n
  local C X
  
  for (( k=0; k<52; k++ )); do
    (( n=UnicodeFraktur+k ))
    X="\U"`printf %x $n`
    C=`echo -e $X`
    AlphaFraktur[k]=$C
  done
} # FrakturLoad

FrakturTranslate(){
  local Input=$1
  local -i i k n Len found
  local A C X 
  
  Len=${#Input}
  for (( i=0; i<Len; i++ )); do
    C=${Input:i:1}
    found=0
    for (( k=0; k<52; k++ )); do
      [[ $C == ${AlphaPlain[k]} ]] && { found=1; break; }
    done
    if (( found==1 )); then
      C=${AlphaFraktur[k]}
    fi
    A+=$C
  done
  echo $A
} #FrakturTranslate


# #################### MAINLINE ###############################
Skull=`echo -e "\U2620"`  # Skull and Crossbones in Unicode
for ((k=0; k<20; k++ )); do
  SkullLine+=$Skull" "
done

FrakturLoad

Str1=`FrakturTranslate "Trick or Treat"`
Str2=`FrakturTranslate "for"`
Str3=`FrakturTranslate "Halloween"`

clear
echo $SkullLine
echo -e "\t"$Str1
echo -e "\t"$Str2
echo -e "\t"$Str3
echo $SkullLine
I get my information on Unicode from http://www.fileformat.info/info/unicode/index.htm.

reinob
Posts: 1189
Joined: 2014-06-30 11:42
Has thanked: 97 times
Been thanked: 47 times

Re: FUN w/ Bash -- Happy Halloween

#2 Post by reinob »

Worksforme :)

With xfce4-terminal, font: Monospace.
On the virtual terminal I get output, but all characters are a small square.

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

Re: FUN w/ Bash -- Happy Halloween

#3 Post by Head_on_a_Stick »

*runs off to find unicode font for rxvt-unicode*
:roll:
deadbang

HarborView
Posts: 41
Joined: 2014-02-01 02:21
Location: The Space Coast of the USA

Re: FUN w/ Bash -- Happy Halloween

#4 Post by HarborView »

I first was amazed years ago when an advertising mailing put a ♥ in the subject line of an email.

Then I got the ABCTajpu extensions for Thunderbird and Firefox and started looking around. I found the best source on it is FileFormat.Info:

http://www.fileformat.info/info/unicode ... s/list.htm

When I put then in emails I only use symbols that it says are now included in Arial because that is pretty much universal. It does not work in the editor for Disqus but it does here.

I have ABCTajpu set up so even in the subject line of an email I can something is radioactive ☢ or poisonous ☣ .

My question about whether the 5 digit math symbols would appear was answered as sometimes yes, sometimes no. Thank you.

Post Reply