I need to use aspell
or any other spe开发者_Python百科ll checking in a command line program. I need to check for a single word only not on a file....
echo $WORD | aspell -a
If you simply require a list of misspelled words then
echo 'word lister to check' | aspell --list
will return the incorrectly spelled words or nothing at all if there are no misspellings
from command line
To check for single word
echo 'blog' | /path_to_aspell/aspell -a
To check for a sentence/paragraph
echo 'blog ia a goud one' | /path_to_aspell/aspell -a
If you have american-english (5) or british-english (5) installed on your linux system, you can simply something similar to the following:
# *note: dog is misspelled below
str=doog
egrep -i ^${str}$ /usr/share/dict/words
if[ $? -ne 0 ] ; then
echo "$str misspelled?"
fi
精彩评论