#!/bin/bash # codepoint.sh - Discover a Unicode Codepoint # Author: Sean B. Palmer, inamidst.com # Usage: ./codepoint DIRECTORY=/usr/local/share/Unidata UNIDATA=$DIRECTORY/UnicodeData.txt URI=http://www.unicode.org/Public/UNIDATA/UnicodeData.txt function error() { echo "Error: $1" >&2 exit 1 } if [ ! -d $DIRECTORY ] then mkdir -p $DIRECTORY || \ error "Couldn't create $DIRECTORY" fi if [ ! -f $UNIDATA ] then echo "Installing $UNIDATA" >&2 wget -O $UNIDATA $URI || \ error "Couldn't install $UNIDATA" chmod 644 $UNIDATA fi egrep -i "$@" $UNIDATA | \ awk -F\; '{ print $1 ": " $2 }' | \ head -n 10 # [EOF]