#!/bin/bash
# Script name: Speller
#
#
# Purpose: Check and fix spelling errors in a file
#
exec < /home/whl/testfile/tmp.log # opens the tmp file
while read line # read from the tmp file
do
echo $line
echo -en "Is this word correct? [Y/N] \n"
read answer < /dev/tty # read from the terminal
case $answer in
[Yy]*)
continue
;;
*)
echo "New word? "
read word < /dev/tty
sed "s/$line/$word/" /home/whl/testfile/tmp.log > error
mv error tmp
echo "$word has been changed."
;;
esac
done