#!/usr/local/bin/bash # #Gspell is a CLI Google Spell Checker #Usage: Gspell #17-08-08 #By:Antonni Delgado #http://www.vfat.org NUM=1 if [ -z $1 ] then echo "Usage: `basename $0` " echo -e "Install:\n\t\$chmod +x $0\n\t#cp $0 /bin/gspell\n\t\$gspell \nBy:Antonni Delgado, www.vfat.org" exit else for i in $@ do tput sgr0 query="`echo $i | sed -e 's/ /+/'`" wget -q -erobots=off --user-agent="Links (2.1pre28; Linux 2.6.22-12-generic i686; x)" http://www.google.com/search?q=$query -O .t0 spell[$NUM]="`grep -o "q=.*&spell=1" .t0 | sed -e 's/.*q=\(.*\)&spell=1.*/\1/'| sed -e 's/+/ /'|tail -n1`" if [ "${spell[$NUM]}" != '' ] then spell[$NUM]="\e[4;31m${spell[$NUM]}\e[m" echo -e "$NUM, ${spell[$NUM]}" else spell[$NUM]="$i" fi NUM=$(( NUM + 1 )) done echo -e "Corrected sentence:" for i in `seq 0 $NUM` do tput sgr0 echo -en "${spell[$i]} " done fi echo