100% Spam Free Email | Contact Us | Products/Services | Korn Shell | MicroEMACS


AIXtm mtXIA Technical Consulting Group

 


mkascii


Current:mkascii
Previous:.
Home Page



################################################################
#### 
#### This function accepts an associative array variable name
#### as the first command line argument, and builds an ASCII
#### table of characters in that array.  Array index is 
#### the ASCII character.  Value is the decimal, hex, or 
#### octal number associated with the ASCII character.
#### 
################################################################
function mkascii
{
  typeset VAL='${CNT}'
  [[ "_${2}" != "_" && "_${2}" =  "_8" ]] && VAL='$( printf "%o" 0x${i}${j} )'
  [[ "_${2}" != "_" && "_${2}" = "_16" ]] && VAL='${i}${j}'
  nameref ASCII_TABLE=$1
  typeset CNT=0
  for i in 0 1 2 3 4 5 6 7 8 9 A B C D E F
  do
    for j in 0 1 2 3 4 5 6 7 8 9 A B C D E F
    do
      eval ASCII_TABLE[\\$(print -- $( printf "\\\0%o" 0x${i}${j} ) )]=\"${VAL}\" 2>/dev/null
      (( CNT = CNT + 1 ))
    done
  done
}

 

For information regarding this page, contact Dana French ( dfrench@mtxia.com )
Copyright 2008 by Mt Xia Inc, All Rights Reserved