9.16. TC Shell Spelling Correction

 <  Day Day Up  >  

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. [7]

[7] From the tcsh man page: "Beware: Spelling correction is not guaranteed to work the way one intends, and is provided as an experimental feature. Suggestions and improvements are welcome."

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 Arguments

Argument

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 (ynea)? yes   Wed Aug 8 19:26:27 PDT 2004  4   >  dite   CORRECT>date (ynea)? no   dite: Command not found.  > 5   >  dite   CORRECT>date (ynea)? edit  >  dite   # Waits for user to edit and then executes command  6   >  dite   CORRECT>date (ynea)? abort  > 

EXPLANATION

  1. 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.

  2. 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.

  3. Because the command was incorrectly spelled, the third prompt, prompt3 , " CORRECT>date (ynea)? " 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.

  4. If the user wants the command to be unchanged, he types an n for no.

  5. If the user wants to edit the correction, he or she types an e , and will be prompted to fix or enhance the command.

  6. If the correction is incorrect or not wanted, the user types an a , and the spelling correction is aborted.

 <  Day Day Up  >  


UNIX Shells by Example
UNIX Shells by Example (4th Edition)
ISBN: 013147572X
EAN: 2147483647
Year: 2004
Pages: 454
Authors: Ellie Quigley

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net