Format
spell [–biluvx]
[–d hashfile]
[–f local] [–h history]
[+local] [file
…]
Restriction: The spell utility
is fully supported for compatibility with older UNIX systems.
However, because it is no longer supported by POSIX.2 IEEE standard
1003.2-1992, this utility should be avoided for applications intended
to be portable to other UNIX-branded systems.
Description
spell checks
for misspelled words in each specified file. If you do not specify a file, it checks
the standard input. A list of potentially misspelled words is produced
on standard output.
Words are checked against a local word
list and then against a hashed word list. The hashed word list included
in this distribution contains virtually no proper names or technical
terms. It is assumed that you will enter these words into your local
word list (or into your machine's word list). Any capitalized word
in the hash list must be capitalized in the input document; all other
words are matched either capitalized or not. All word forms, including
plurals, must be explicitly included in the hash list. This approach
prevents the acceptance of nonsense words that can result from the
algorithmic combination of legal roots with legal suffixes or prefixes,
a phenomenon common to many other spelling checkers.
Options
- –b
- Uses British spelling (such as “colour” instead of “color”). The
dictionary file used is /usr/lib/hashb instead of /usr/lib/hash.
- –d hashfile
- Uses hashfile as the dictionary. hashfile is
a hash list produced from a list of words using the -i option
of spell. To use a list other than the default /usr/lib/hash,
the –d option must be specified.
- –f local
- Uses the file local as a dictionary
of local words, given one word per line. If you do not specify this
option, the file /usr/lib/lwords is used as the
local dictionary.
- –h history
- Appends a history of all misspelled words to the file history.
This file can be used by a system administrator for dictionary maintenance
or generating a local dictionary.
- –i
- Creates a new hash list file or add words to an existing file,
instead of checking for spelling errors. Words to be entered into
the dictionary should be specified one per line with no white space
on the line. Lines beginning with the # character
are ignored as comments. Be sure that the words you are entering into
the hash list are correctly spelled.
- –l
- Produces a longer form of output. For each misspelled word, spell prints
three tab-separated columns containing the misspelled word, the line
number, and the file name.
- –u
- Forces spell to accept any word that
is in all uppercase. spell assumes that
such words are acronyms.
- –v
- Writes to stdout all words not literally in the dictionary.
This is the default for this implementation because it doesn't apply
suffix/prefix rules to derive words.
- –x
- Writes each plausible word stem to stdout. Because this
implementation of spell doesn't derive words,
all words are their own word stems.
- + local
- Uses the file local as a dictionary
of local words, given one word per line. This is synonymous with –f.
Examples
By default,
spell does
not sort the output. This maintains the order and number of occurrences
of spelling errors. The following command checks for spelling errors,
puts them in dictionary order, removes duplicates, and print them
in a multicolumn format:
spell file | sort –dfu | c
Localization
spell uses
the following localization environment variables:
- LANG
- LC_ALL
- LC_CTYPE
- LC_MESSAGES
- LC_SYNTAX
- NLSPATH
See Localization for more
information.
Exit values
- 0
- Successful completion
- 1
- Failure due to any of the following:
- Missing hashfile name after –d
- Missing history file name after –h
- Missing local file name after –f
- Inability to open the local file
- Receipt of user interrupt
- An error reading the dictionary file
A spelling mistake is not considered an error.
- 2
- Incorrect command-line option
Files
spell uses
the following files:
- /usr/lib
- The default location
of user hash files.
- /usr/lib/hash
- The default dictionary
file, in hashed form.
- /usr/lib/hashb
- The British dictionary
file, in hashed form.
- /usr/lib/lwords
- The default location
of the local words file. This need not exist.
Limits
Input lines in the text being checked
are restricted to a maximum of 100 characters.
Portability
X/Open Portability Guide, UNIX systems.
The –d, –f, –h, –i, –l,
and –u options are extensions of the POSIX
standard.
Related information
sort, vi