Sponsored Content
Full Discussion: Writing a script for aspell
Homework and Emergencies Homework & Coursework Questions Writing a script for aspell Post 302865815 by gamernerd101 on Sunday 20th of October 2013 01:18:35 AM
Old 10-20-2013
Writing a script for aspell

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!

1. The problem statement, all variables and given/known data:
The scirpt I have is meant to check the strings read in from a file with the aspell subroutine in the UNIX bash shell. I don't seem to have a problem reading it and checking it. Only printing it correctly.

I'm having some trouble with my script/understanding it fully. I want to print out all of the items stored in uncorrect in the mispelled columns I have set under the mispelled table. Then print out the values corrected with user input. Am I not storing them correctly? Or am I not calling them correctly in my last echo statement? I'm really just lost for syntax. Forgive me I'm new at this and am just having trouble understanding it. Thanks so much for your help in advance.


2. Relevant commands, code, scripts, algorithms:
It was recommended in my assignment that we use the ASPELL LIST command, but I didn't know how to properly implement it.


3. The attempts at a solution (include all code and scripts):
Code:
#! /bin/bash

#empty array's created to store the new spelling and old ones.
reSpell=()
uncorrect=()
# now check the spellings
let count=1

check=(`aspell list -p ~/.checked < $1`)
# for each mispelled word in the file is entered into i and put into the new directory memory if corrected
for i in ${check[*]} ; do
   uncorrect[$count]=$i
   read -p "$i is mispelled. Press \"Enter\" to keep this spelling or type your new spelling here: " newSpell

   # unfixed spellings are ignored and not replaced and are left where they are in the fiexedspell array
if [ "$newSpell"="" ]; then
   echo $i>> ~/.memory

else
   reSpell[$count]=$newSpell
fi
   count+=1
   echo ""

done


printf "MISPELLED %20s\n" CORRECTIONS
echo ""
let counter=1
for i in ${reSpell[*]}; do

   echo "{uncorrect[$counter]} %-20s%s\n" "${reSpell[$counter]}"

   counter+=1
done



4.
NIU, Dekalb, Il , Ege, CSCI330

Note: Without school/professor/course information, you will be banned if you post here! You must complete the entire template (not just parts of it).

Last edited by Don Cragun; 10-20-2013 at 03:06 AM.. Reason: Add CODE tags.
 

2 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

redirecting the output of aspell

Hi, I have 2 identical servers both running aspell but for some reason I can't redirect the output to a file on one of them. This is what I'm trying to do: echo feck | aspell -l > errors.txt On one machine this works fine but the other it doesn't (the file is created but it is empty). ... (6 Replies)
Discussion started by: leekb
6 Replies

2. UNIX for Dummies Questions & Answers

Trouble getting aspell to work

Hi: I've tried to get aspell to work to check a latex document I have. I get this error message: Error: No word lists can be found for the language "en_CA". Can anyone offer any suggestions? I'm trying to get a good spell-checker set up for my latex documents. Excalibur does not work all... (1 Reply)
Discussion started by: spindoctor
1 Replies
echo(1B)					     SunOS/BSD Compatibility Package Commands						  echo(1B)

NAME
echo - echo arguments to standard output SYNOPSIS
/usr/ucb/echo [-n] [argument] DESCRIPTION
echo writes its arguments, separated by BLANKs and terminated by a NEWLINE, to the standard output. echo is useful for producing diagnostics in command files and for sending known data into a pipe, and for displaying the contents of envi- ronment variables. For example, you can use echo to determine how many subdirectories below the root directory (/) is your current directory, as follows: o echo your current-working-directory's full pathname o pipe the output through tr to translate the path's embedded slash-characters into space-characters o pipe that output through wc -w for a count of the names in your path. example% /usr/bin/echo "echo $PWD | tr '/' ' ' | wc -w" See tr(1) and wc(1) for their functionality. The shells csh(1), ksh(1), and sh(1), each have an echo built-in command, which, by default, will have precedence, and will be invoked if the user calls echo without a full pathname. /usr/ucb/echo and csh's echo() have an -n option, but do not understand back-slashed escape characters. sh's echo(), ksh's echo(), and /usr/bin/echo, on the other hand, understand the black-slashed escape characters, and ksh's echo() also understands a as the audible bell character; however, these commands do not have an -n option. OPTIONS
-n Do not add the NEWLINE to the output. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWscpu | +-----------------------------+-----------------------------+ SEE ALSO
csh(1), echo(1), ksh(1), sh(1), tr(1), wc(1), attributes(5) NOTES
The -n option is a transition aid for BSD applications, and may not be supported in future releases. SunOS 5.11 3 Aug 1994 echo(1B)
All times are GMT -4. The time now is 10:52 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy