Google Spell Checker

spellcheck(){ typeset y=$@;curl -sd "<spellrequest><text>$y</text></spellrequest>" https://www.google.com/tbproxy/spell|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>" https://google.com/tbproxy/spell|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
OK

5
2010-02-17 08:20:48

1 Alternatives + Submit Alt

What Others Think

This no longer works.
matthewbauer · 407 weeks and 3 days ago
Okay wait a second... It looks like it works if you use https://www.google.com/tbproxy/spell instead of the one without the "
matthewbauer · 407 weeks and 3 days ago
What's interesting is that Google Docs uses the https://google.com/tbproxy/spell 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: http://googledocs.blogspot.com/2010/08/table-resizing-and-other-niceties-in.html
matthewbauer · 407 weeks and 3 days ago
Thanks for the help. I've update the command.
eightmillion · 407 weeks and 3 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?

commandlinefu.com 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.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

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: