The Single UNIX ® Specification, Version 2
Copyright © 1997 The Open Group


spell - find spelling errors (LEGACY)


spell [-bvx][+local_file][file...]


The spell utility collects words from the named files and looks them up in a spelling list. A word in this context is a series of characters from the set:


in the POSIX locale, where the first and last characters are alphanumeric. Words that neither occur among nor are derivable (by applying certain inflections, prefixes and suffixes) from words in the spelling list are written to standard output.

Within the file, certain character sequences are treated specially; if the file contains lines that begin with a period or apostrophe or that contain backslashes in any position, the results are unspecified.


The spell utility supports the XBD specification, Utility Syntax Guidelines  , except that the +local_file option takes a leading plus sign instead of minus. The following options are supported:

Write all words not literally in the spelling list. Plausible derivations from the words in the spelling list may be indicated.
Check British spelling. Besides preferring centre, colour, programme, speciality, travelled, and so on, this option insists upon -ise in words like standardise.
Write every plausible stem with "=" for each word.
Remove words found in local_file from the spell command output. The argument local_file is the name of a user-provided file that contains a sorted list of words, one per line. With this option, the user can specify a set of words that are correct spellings (in addition to spell's own spelling list) for each job.


The following operands are supported:
A pathname of a text file to check for spelling errors. If no files are named, words are collected from the standard input.


The standard input is a text file used only if no file operands are specified.


The input files are text files.


The following environment variables may affect the execution of spell:
Provide a default value for the internationalisation variables that are unset or null. If LANG is unset or null, the corresponding value from the implementation-dependent default locale will be used. If any of the internationalisation variables contains an invalid setting, the utility will behave as if none of the variables had been defined.
If set to a non-empty string value, override the values of all the other internationalisation variables.
Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single- as opposed to multi-byte characters in arguments and input files).
Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error.
Determine the location of message catalogues for the processing of LC_MESSAGES .




The standard output consists of single misspelled words separated by newlines. If the -x option is used, words can be preceded by "=".


Used only for diagnostic messages.






The following exit values are returned:
Successful completion.
An error occurred.




None of the internationalisation variables are required to affect the processing of the input source language. In the POSIX locale, the spell utility recognises English (American or British dialects, depending on the -b option) text.

The unspecified nature of spell when presented files with backslashes or leading periods or leading apostrophes results from its complex attempts to deal with files formatted for troff, tbl and eqn processing (none of which are specified by this specification). Constructs such as .so, .nx, .TS, .EQ, .ig, \s and \f are frequently dealt with in a manner that is most useful for determining spelling errors. However, such algorithms are historically less than perfect and are very difficult to describe precisely.

This utility is marked LEGACY because there is no known technology that can be used to make it recognise general language for user-specified input without providing a complete dictionary along with the input file.







UNIX ® is a registered Trademark of The Open Group.
Copyright © 1997 The Open Group
[ Main Index | XSH | XCU | XBD | XCURSES | XNS ]