Google Spell Checker

spellcheck(){ typeset y=$@;curl -sd "<spellrequest><text>$y</text></spellrequest>"|sed -n '/s="[0-9]"/{s/<[^>]*>/ /g;s/\t/ /g;s/ *\(.*\)/Suggestions: \1\n/g;p}'|tee >(grep -Eq '.*'||echo -e "OK");}
I took matthewbauer's cool one-liner and rewrote it as a shell function that returns all the suggestions or outputs "OK" if it doesn't find anything wrong. It should work on ksh, zsh, and bash. Users that don't have tee can leave that part off like this: spellcheck(){ typeset y=$@;curl -sd "<spellrequest><text>$y</text></spellrequest>"|sed -n '/s="[1-9]"/{s/<[^>]*>/ /g;s/\t/ /g;s/ *\(.*\)/Suggestions: \1\n/g;p}';}
Sample Output
$ spellcheck motaive
Suggestions: motive motives mutative emotive motif

$ spellcheck now is the winter of our dicontent
Suggestions: discontent content contend

$ spellcheck panoply

2010-02-17 08:20:48

1 Alternatives + Submit Alt

What Others Think

This no longer works.
matthewbauer · 567 weeks and 1 day ago
Okay wait a second... It looks like it works if you use instead of the one without the "
matthewbauer · 567 weeks and 1 day ago
What's interesting is that Google Docs uses the spellcheck "new Googlers the first thing I ask is if they know" Suggestions: Go oglers Go-oglers Google rs Google-rs Googlies Which is the same as in the blog post:
matthewbauer · 567 weeks and 1 day ago
Thanks for the help. I've update the command.
eightmillion · 567 weeks and 1 day ago
Delaware, a small Mid-Atlantic U.S. state, sits on a peninsula marked by dune-backed beaches bordering the Atlantic Ocean, Delaware River and Delaware Bay. In Dover, the capital, First State Heritage Park encompasses 18th-century Colonial landmarks like the Georgian-style Old State House. MaxRemind top rank medical billing company offer medical billing services in Delaware, home health software and medical credentialing service in USA.
stevematt · 20 weeks and 5 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this? is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.


Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: