![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| convert the below perl sript to shell script | mail2sant | Shell Programming and Scripting | 1 | 04-04-2008 02:36 PM |
| Shell Sript | jazz8146 | UNIX for Dummies Questions & Answers | 3 | 01-11-2008 02:07 PM |
| how to assign sql output data to shell script variable | kattics | Shell Programming and Scripting | 1 | 07-07-2006 04:57 PM |
| spell checker program | ksjanakan | Shell Programming and Scripting | 2 | 05-21-2005 01:15 AM |
| Shell script syntax checker | handak9 | Shell Programming and Scripting | 2 | 07-16-2004 04:56 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Shell Sript - Spell Checker Assign
Hi Folks. I am currently working on a script that has to spell check a file and print the output to the screen in 2 columns like this.
INCORRECT CORRECTION whio who weahter weather The file will allow the user to override the ispell command and save any 'incorrect' words as 'correct' into a memory file which would then be used in any other runs of the script (as a dictionary file). The code i currently have has a problem with it... and i cant figure it out for the life of me. Here is the code/script that i have written so far. Code:
#!/bin/sh
# script that will spell check a file
#if user tries to quit, will say so, then quit on second attempt
trap "echo You are trying to exit; exit" 2
array=`ispell -l -p $HOME/memory.txt < $1`
correct=()
incorrect=""
let counter=1
for i in $array; do
read -p "$i is mispelled. Press "Enter" to keep spelling, or type a correction here: " correction
if [[$correction=""]] ; then
echo $i >> $HOME/memory.txt
else
$correct[$counter]=$correction
fi
let counter+=1
done
#prints the information
echo "CORRECTION INCORRECT"
let count=1
for i in $array; do
echo ${correct[$count]} $i
let count+=1
done
sh-3.1$ ./wordspell testfile hellio is mispelled. Press Enter to keep spelling, or type a correction here: hello ./wordspell: line 14: [[hello=]]: command not found ./wordspell: line 17: [1]=hello: command not found whio is mispelled. Press Enter to keep spelling, or type a correction here: who ./wordspell: line 14: [[who=]]: command not found ./wordspell: line 17: [2]=who: command not found wheter is mispelled. Press Enter to keep spelling, or type a correction here: weather ./wordspell: line 14: [[weather=]]: command not found ./wordspell: line 17: [3]=weather: command not found CORRECTION INCORRECT hellio whio wheter I was wondering how i could sort out the line 14/17 errors. I have thought it would be something like missing () or {} in the array. But still no luck. Any ideas? Also, as you can see i want to print the correction, and the incorrect word (i have 2 arrays set, correct and incorrect which should contain the words for each). How would i get them to print out in columns like i have shown? Once i have this, i have another couple of things to code which im unsure of, but i will try after i get thsi first obstacle out of the way. Thanks in advance |
|
||||
|
Quote:
Hope some advice still comes in, thanks for your time! |
|
||||
|
Cheers- but still...
Quote:
I still get this: sh-3.1$ ./wordspell testfile hellio is mispelled. Press Enter to keep spelling, or type a correction here: hello ./wordspell: line 14: [[hello=]]: command not found ./wordspell: line 17: [1]=hello: command not found Its got something to do with the arrays for sure - i have no idea why tho. I might be thinking arrays too much like C++ arrays if that helps. lol. Anything is worth a look right? |
|
||||
|
Quote:
Quote:
Quote:
/Lakris |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|