spell

detect spelling errors 

Command


SYNOPSIS

spell [-ilu] [-d hashfile] [-f local] [-h history] [file ...]


DESCRIPTION

spell checks for misspelled words in each input file. If no file is specified, it checks the standard input. A list of potentially misspelled words is produced on the standard output.

The input to spell is first turned into a list of words in the manner of the -w option of deroff.

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 such words are going to be entered into the user's or machine's local 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

-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 ROOTDIR/etc/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 ROOTDIR/etc/lwords is used as the local dictionary.

-h history 

appends a history of all misspelled words to the file history. This file may 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 very sure that the words you are entering into the hash list are correctly spelled, because there are few things more embarrassing than incorrect words in a spelling dictionary.

-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 all uppercase. spell assumes that such words are acronyms.


EXAMPLE

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 multi-column format:

spell file | sort -dfu | c

DIAGNOSTICS

Possible exit status values are:

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
— invalid command line option
— inability to open local file
— receipt of user interrupt
— an error reading the dictionary file
A spelling mistake is not considered an error.
2 

Invalid command line option.


FILES

ROOTDIR/etc/hash 

The default dictionary file, in hashed form.

ROOTDIR/etc/words 

The dictionary used to create ROOTDIR/etc/hash.

ROOTDIR/etc/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 4.0. All UNIX systems. Windows 10. Windows Server 2016. Windows Server 2019. Windows 11. Windows Server 2022. Windows Server 2025.

The -d, -f, -h, -i, -l, and -u options are extensions to x/OPEN.


AVAILABILITY

PTC MKS Toolkit for Power Users
PTC MKS Toolkit for System Administrators
PTC MKS Toolkit for Developers
PTC MKS Toolkit for Interoperability
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Commands:
deroff, look, sort, vi


PTC MKS Toolkit 10.5 Documentation Build 40.