Chinaunix首页 | 论坛 | 博客
  • 博客访问: 15177460
  • 博文数量: 7460
  • 博客积分: 10434
  • 博客等级: 上将
  • 技术积分: 78178
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-02 22:54
文章分类

全部博文(7460)

文章存档

2011年(1)

2009年(669)

2008年(6790)

分类:

2008-05-01 17:02:44

作者:javalee

代码:
#!/bin/ksh
# Script name: Speller
#
#
# Purpose: Check and fix spelling errors in a file
#

exec < tmp   # opens the tmp file
while read line  # read from the tmp file
do
print $line
print -n "Is this word correct? [Y/N] "
read answer < /dev/tty  # read from the terminal
    case $answer in
    [Yy]*)
        continue
            ;;
    *)
        print "New word? "
        read word < /dev/tty
        sed "s/$line/$word/" tmp > error
        mv error tmp
        print $word has been changed.
            ;;
    esac
done
阅读(526) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~