Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a shell script that implements a simple spell checker. The name of your script is formed from your Z-id followed by .spell. For example,

Write a shell script that implements a simple spell checker. The name of your script is formed from your Z-id followed by ".spell". For example, if your Z-id is "z123456" then your script must be called "z123456.spell".

The general format for invocation is:

z123456.spell file

where "z123456.spell" is the name of the executable file that contains your shell script, and "file" refers to the file to be checked word-by-word for spelling.

Your are encouraged to take advantage of the " aspell list" command. It produces a list of misspelled words from standard input.

Specification:

When your script is invoked from the command line it reads "file" and checks it for spelling of the words it contains. For each word that is found to be incorrect, the invoker is asked for either:

  • to insist on the spelling of the word.
  • to provide a replacement spelling

If the invoker insists on the spelling of the word, then your script will "remember" it. Your script "remembers" words in the file "~/.memory" in the invoker's home directory. Any further invocation of your script by the same invoker will consider the word to be correct.

Otherwise, the invoker is prompted for a replacement spelling. As output, your script produces a 2-column-ed list of words, the left column lists incorrectly spelled words, the right column lists their replacement as given by the invoker. The list is produced after the invoker has answered to all incorrectly spelled words.

Here is an example of an invocation of your script with a testfile:image text in transcribed

13 testfile z123456.spell cat testfile In navigation, a vehicle's course is the agle that the intended path of the vehicle makes with a fixed reference objekt (typically truenorth). Course is measured in degrees from 0 clockwise to 360 in ECMD compa33 convention (0 being north, 90 being east). Course is customarily expressed in three digits, using preliminary zeros if needed. ./z123456.spell testfile 'agle' is mispelled. Press "Enter" to keep this spelling, or type a correction here: angle 'objekt' is mispelled. Press "Enter" to keep this spelling, or type a correction here: object 'truenorth' is mispelled. Press "Enter" to keep this spelling, or type a correction here: 'ECMD' is mispelled. Press "Enter" to keep this spelling, or type a correction here: MISPELLED: CORRECTIONS: agle objekt angle object ./2123456.spell testfile 'agle' is mispelled. Press "Enter" to keep this spelling, or type a correction here: angle 'objekt' is mispelled. Press "Enter" to keep this spelling, or type a correction here: object MISPELLED: CORRECTIONS: agle objekt angle object cat - .memory truenorth ECMD cat testfile In navigation, a vehicle's course is the agle that the intended path of the vehicle makes with a fixed reference objekt (typically truenorth). Course is measured in degrees from 0 clockwise to 360 in ECMD compass convention (0 being north, 90 being east). Course is customarily expressed in three digits, using preliminary zeros if needed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Knowledge of project management (PMI) teachings

Answered: 1 week ago