UNIX Command-Line Spellcheck

Dec 26, 2002 5:02 PM
Tags: bash, linux, unix
Random UNIX tip of the day:

Aliases (i.e. .bashrc aliases) don't take arguments. Use a function instead.

Initially, I had:
alias sp='echo $1 | ispell -a'
but that didn't work. (It turns out this was because $1 had never been initialized and set to the value I expected.) Instead, I had to do:
sp () {
    echo $1 | ispell -a
}
at Barry Margolin's suggestion, and it worked like a charm. And now I can do stuff like this:
$ sp "recieve"
@(#) International Ispell Version 3.1.20 (but really Aspell .33.7.1 alpha)
& recieve 16 0: receive, receiver, Recife, relieve, received, 
receives, revive, reeve, reserve, deceive, reliever, recede, 
receivers, recipe, recite, relive

update Joe Halpin gave me even better advice, going so far as to write the small function above (though I'd already taken that step on my own ... damn Google Groups lag).

This blog is no longer active, and comments have been disabled.