#!/bin/sh # Look up selected word in dictionary (wn) and display info in xmessage popup. # ('selected word' is primary X selection) # Requires 'xclip', 'sselp' or similar program. Usage=" Usage: wnx -[d|a|s] word\n word is required\n plus 1 of the below:\n -d definition\n -t thesaurus\n -a antonymns\n -s synonymns" usage () { /bin/echo -e $Usage | xmessage -center -title "WordNet Error" -file - exit 1 } # process args while getopts dtasw: arg do case $arg in d) action="-over"; title="Dictionary";; a) action="-antsn -antsv -antsa -antsr"; title="Antonymns";; s) action="-synsn -synsv -synsa -synsr "; title="Synonymns";; t) action="-synsn -synsv -synsa -synsr -antsn -antsv -antsa -antsr"; \ title="Thesaurus";; w) word=$OPTARG;; \?) usage;; esac done # the word is required if [ -z $word ]; then #word=`xclip -o -selection primary` word=`sselp` fi if [ -z "$action" ]; then action="-over"; title="Dictionary"; fi #echo word $word #echo #echo cl "wn $word $action"; #echo msg=`wn "$word" $action` if [ -n "$msg" ]; then echo "$msg" | fold -w 95 | boxes -d ada-box -p a2 | \ xmessage -title $title -file - & fi #if [ -n "$action" -a -n "$word" ]; then # wn "$word" $action | fold -w 95 | boxes -d ada-box -p a2 | \ # xmessage -title $title -file - & #fi # other nice boxes # ada-box # columns # diamonds # peek