#!/bin/bash # # Write by Keidii ;] # ( with robmal support ;) # LANGZ="pl en" # list of language to chcek #NOTE : you must got aspell-XX where XX is lagguage code ;] ENCODE="UTF-8" # encoding for aspell # iso8852-2 = polish # utf-8 # etc... #wite list of non-errors ;], not case sensitive # these are like regexp GOOD_PHASE="" # these are word-exp #GOOD_WORDS="alsa sed emerge portage unix linux hardened cron logger uri dmesg #kernel bash ebuild eclass runlevel" GOOD_WORDS="$(cat /home/rane/work/docs-pl/rane/words.txt)" USE_LISTS="YES" # use white lists ? default = yes TRYB="short" # what mode ? can be : short, mid, full # short - just print error # mid - show line numbers # full - show context if [ "${1}" != "" ]; then PLIK=$1 if [ -a $1 ]; then echo -en "" #istnieje else echo "!-> cant find $1 " exit fi; else echo "Usage : ./spellit FILENAME" exit fi; echo -en "--> checkng >${PLIK}< " #clean it rm -f /tmp/spell.* cp $PLIK /tmp/spell.tmp 1> /dev/null 2>/dev/null sed -e 's/<.*>/ /' /tmp/spell.tmp | sed -ne '/.[[:alpha:]]/p' >> /tmp/spell.tmp2 rm -f /tmp/spell.tmp mv /tmp/spell.tmp2 /tmp/spell.tmp #clean from any <> codes ;] for LNG in $LANGZ; do cat /tmp/spell.tmp | aspell list --lang=${LNG} --encoding=${ENCODE} | sort | uniq >> /tmp/spell.err done; # :] cat /tmp/spell.err | sort | uniq -d > /tmp/spell.er2 rm -f /tmp/spell.err mv /tmp/spell.er2 /tmp/spell.err echo " ... done" echo "--> Errors: " #got error list in /tmp/spell.err # apply good word lists if [ "${USE_LISTS}" = "YES" ]; then #skip god "word" for BB in $GOOD_WORDS; do cat /tmp/spell.err | grep -ivw $BB >> /tmp/spell.e rm -f /tmp/spell.err mv /tmp/spell.e /tmp/spell.err done; #skip good "*word*" for BB in $GOOD_PHASE; do cat /tmp/spell.err | grep -iv $BB >> /tmp/spell.e rm -f /tmp/spell.err mv /tmp/spell.e /tmp/spell.err done; fi; case "${TRYB}" in full) for EE in $(cat /tmp/spell.err); do echo -en "-!->Zonk \"${EE}\" at :\n" cat $PLIK | grep -n -w $EE; echo " -- -- " done; ;; mid) for EE in $(cat /tmp/spell.err); do echo -en "-!- \"${EE}\" line : " cat $PLIK | grep -n -w $EE | sed -e 's/:.*$//' | tr "\n" " " echo " ; " done; ;; *) # enythink else or mini ;] cat /tmp/spell.err ;; esac; #clean it rm -f /tmp/spell.* echo "--| stop"