root/linux/bin/beschreibe @ 753

Revision 753, 1.9 KB (checked in by pascal, 5 years ago)

Schönheitsfehler

  • Property svn:executable set to *
Line 
1#!/bin/sh
2
3# Verzeichnis muss eventuell an den Ort der Compose angepasst werden:
4COMPOSE=/usr/share/X11/locale/en_US.UTF-8/Compose
5KEYSYM=/usr/include/X11/keysymdef.h
6n=10
7typeset -i j=0
8
9while [ ! "$beschreibung" ]
10do
11        case ${1-" "} in
12        " ")
13                echo Aufruf: $0 [OPTION] BESCHREIBUNG
14                echo »$0 --help« gibt Ihnen mehr Informationen.
15                exit;;
16        --help)
17                echo Aufruf: $0 [OPTION] BESCHREIBUNG
18                echo »$0« versucht ein Zeichen anhand einer Beschreibung zu idetifizieren
19                echo Option:
20                echo -e "  -n               gibt maximal 2n statt 10 Vorschläge aus"
21                exit;;
22        \ )
23                echo $0: Kein Suchkriterium eingegeben!
24                echo Versuchen Sie »$0 --help« für weitere Informationen.
25                exit;;
26        -*)
27                n=`echo $1 | cut -c2-`
28                shift;;
29        *)
30                beschreibung=${*?$0: Fehler! Versuchen Sie »$0 --help« für weitere Informationen.}
31        esac
32done
33
34anzahl=`grep -iw $beschreibung $COMPOSE | head -$n | wc -l`
35if [ $anzahl -gt 0 ]
36then
37        ausgabe=1
38        for i in $(seq 1 $anzahl)
39        do
40                j=j+1
41                a[$j]=`grep -iw $beschreibung $COMPOSE | grep ^\< | head -$i | tail -1 | cut -f2 -d \"`
42                echo $j\) ${a[$j]}
43        done
44fi
45
46anzahl2=`grep -i [\ _]$beschreibung[\ _] $KEYSYM | head -$n | wc -l`
47if [ $anzahl2 -gt 0 ]
48then
49        ausgabe=1
50        for i in $(seq 1 $anzahl2)
51        do
52                c=`grep -i [\ _]$beschreibung[\ _] $KEYSYM | grep ^#define  | head -$i | tail -1 | cut -f2- -d\* | cut -f2- -d+ | cut -f1 -d\ `
53                c1=`echo $c | cut -c1-2`
54                c2=`echo $c | cut -c3`
55                c3=`echo $c | cut -c4`
56
57                case $c1 in
58                00)
59                        j=j+1
60                        a[$j]=`echo -e \\\x${c2}`
61                        echo $j\) ${a[$j]}
62                        ;;
63                03)     
64                        if [ "$c2" = "C" ]
65                        then
66                                j=j+1
67                                a[$j]=`echo -e \\\xcf\\\x8${c3}`
68                                echo $j\) ${a[$j]}
69
70                        else
71                                j=j+1
72                                a[$j]=`echo -e \\\xce\\\x${c2}${c3}`
73                                echo $j\) ${a[$j]}
74                        fi
75                        ;;
76                *)
77                        ;;
78                esac   
79        done
80fi
81
82if [ $ausgabe ]
83then
84        read -p 'welches Zeichen suchen Sie: ' zahl
85        echo
86else
87        echo „$beschreibung“ ist unbekannt, versuchen Sie eine andere Beschreibung.
88        exit
89fi
90
91if [ ${a[$zahl]} ]
92then
93        ./wiemitneo ${a[$zahl]}
94fi
Note: See TracBrowser for help on using the browser.