9.16. TC Shell Spelling Correction
Spelling correction, a feature added to the TC shell, is the ability to correct spelling errors in filenames, commands, and variables. If using the emacs built-in editor, the spelling error can be corrected by using the spelling correction keys, bound to the Meta-s or Meta-S keys (use the Alt or Esc key if you don't have Meta) and Meta-$ to correct an entire line. The value of the prompt, prompt3, displays the spelling correction prompt.
If you are using the vi built-in editor, set the built-in variable correct, and the shell will prompt you to fix the spelling.
Table 9.18. The correct Variable ArgumentsArgument | What It Does |
---|
all | Spell-corrects entire command line | cmd | Spell-corrects commands | complete | Completes commands |
Example 9.93.
1 > fimger[Alt-s] # Replaces fimger with finger
2 > set correct=all
3 > dite
CORRECT>date (y|n|e|a)? yes
Wed Aug 8 19:26:27 PDT 2004
4 > dite
CORRECT>date (y|n|e|a)? no
dite: Command not found.
>
5 > dite
CORRECT>date (y|n|e|a)? edit
> dite # Waits for user to edit and then executes command
6 > dite
CORRECT>date (y|n|e|a)? abort
>
EXPLANATION
By pressing the Meta (or Alt or Esc) key together with an s, the spelling of a command, filename, or variable can be corrected. This does not work if you are using the built-in vi editor. By setting correct to all, tcsh will attempt to correct all spelling errors in the command line. This feature is available for both emacs and vi keybindings. Because the command was incorrectly spelled, the third prompt, prompt3, "CORRECT>date (y|n|e|a)?" appears on the screen, and the user is supposed to type the letter y if he or she wants the spelling corrected, an n if not, an e if he or she wants to edit the line, or an a if he or she wants to abort the whole operation. If the user wants the command to be unchanged, he types an n for no. If the user wants to edit the correction, he or she types an e, and will be prompted to fix or enhance the command. If the correction is incorrect or not wanted, the user types an a, and the spelling correction is aborted.
|