专注各种脚本编程
Baidu
加入收藏夹
本站内容有下面分类知识,欢迎您的到来^_^
shell相关:指令篇 基础篇 脚本欣赏 编程实例 shell问问 shell视频教程 技巧篇 水平测试 E文资料 vi编辑器 高级Bash脚本编程指南
其他:mysql perl c语言 oracle
当前位置:| 主页>shell脚本欣赏>

检查拼写错误的脚本

百度收藏 QQ搜藏

脚本代码:

#!/bin/bash
#directory.sh
#check the word spelling errors in the given text
E_BADARGS=65
[ $# -lt 2 ]&&echo "Usage:./directory filename1 filename2."&&exit \
$E_BADARGS

echo "###################Mcknight##############################"
path="/usr/share/dict/linux.words"
#modify the text file to suit the search
cat $1|tr A-Z a-z|sed 's/[,!?.]/ /g'|sed 's/ */ /g' >$2

for word in $(cat $2);do
if [ "$word" == "i" ];then
continue
fi #donnot want "i" to bother!
grep -q "\<$word\>" $path
if [ "$?" -eq 0 ];then
continue
else
echo -e "\033[0;31m$word \033[1;37mspells wrongly!"
fi
done
echo "###################Check done!###########################"

上一篇:判断网络中存活主机的shell 下一篇:ping测试的报警shell

power by soyo123 2007-2008