Here’s a short bash script, using aspell, to spell check a word or several words from the command line. It’s simple but effective. If anyone else knows a cleaner or even simpler way, please let us know.
#!/bin/bash
WORD=$1
TEMPFILE=temp.spell
echo $WORD > $TEMPFILE
aspell -c $TEMPFILE
cat $TEMPFILE
rm -f $TEMPFILE
rm -f $TEMPFILE.bak
I named this script “spell”. Simply use it like so:
$ spell reccomend
Aspell will run and you can make your changes.
reccomend
1) recommends 6) commend
2) recommend 7) recommenced
3) reckoned
recommended
4) regiment 9) Redmond
5) recombined 0) rejoined
i) Ignore I) Ignore all
r) Replace R) Replace all
a) Add l) Add Lower
b) Abort x) Exit
In this case, if I type “2″, the correction will be made, aspell will exit and the spelling I chose gets printed out.
Here’s an example of how to use it with a sentence.
$ spell "I go to the storede and buy beakh clotes"
Now aspell will take you through each misspelled word. After you finish the corrections it will exit and print out the corrected sentence or series of words.
I go to the store and buy beach clothes
4 Comments
Hi there
I’m really sorry for mis-using this comment box, but I didn’t find another easy way to contact your guys.
I found a link to an archived page of your website, but this link doesn’t work anymore. It’s http://reverttoconsole.com/archives/169 from an Apple discussion thread, http://discussions.apple.com/thread.jspa?threadID=1264582.
I’d be really interested in the content of this link, so is it still available somewhere?
Thanks a lot for reply.
Joshua
it’s here
or try:
echo reccomend | aspell -a
Excellent Jason. Thanks for sharing!
Post a Comment