| | |
reading input problem.
![]() |
•
•
Join Date: Sep 2009
Posts: 4
Reputation:
Solved Threads: 0
The problem I'm having is that I want to read in whether the user wants to keep the spelling or change it, but the "read spelling" pulls from the 'line' and not from user input.
my assignment description is as follows.
Write a shell script that implements an interactive spell checker. The general format for invocation is:
wordspell file
where "wordspell" 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 "ispell -l" command. It produces a list of misspelled words from standard input.
Specification:
wordspell reads "file" and checks it for spelling of the words it contains. wordspell is invoked interactively. 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 this word is added to wordspell's "memory". wordspell remembers words in the file "memory" in the invoker's home directory. Any further invocation of wordspell by the same invoker will consider the word to be correct.
Otherwise the invoker is prompted for a replacement spelling. As output, wordspell 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.
Any help would be appreciated. thanks!
my assignment description is as follows.
Write a shell script that implements an interactive spell checker. The general format for invocation is:
wordspell file
where "wordspell" 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 "ispell -l" command. It produces a list of misspelled words from standard input.
Specification:
wordspell reads "file" and checks it for spelling of the words it contains. wordspell is invoked interactively. 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 this word is added to wordspell's "memory". wordspell remembers words in the file "memory" in the invoker's home directory. Any further invocation of wordspell by the same invoker will consider the word to be correct.
Otherwise the invoker is prompted for a replacement spelling. As output, wordspell 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.
Shell Scripting Syntax (Toggle Plain Text)
#! /bin/bash touch memory touch tempword ispell -l < "$1" | while read line do echo "$line is mispelled. Press "'Enter'" to keep this spelling, or type a correction here:" read spelling if [$spelling = ""]; then echo $line >> memory else echo $spelling >> tempword fi done paste memory tempword > allfile #echo $allfile
Any help would be appreciated. thanks!
![]() |
Similar Threads
- reading Input from File (Java)
- Need some help with reading from input file [newbie] (Python)
- Reading an input file as a class memeber function (C++)
- Number input problem. (C++)
- Input for a solution to matrix problem (C)
- Question:: reading from an input stream. (C++)
- reading a same input twice from the console (C)
- reading input ... quick C++ question ... (C++)
Other Threads in the Shell Scripting Forum
- Previous Thread: how to move files and check the completion.
- Next Thread: Problem printing date
| Thread Tools | Search this Thread |





