shell 检查一个单词是否在字典中

#!/bin/bash
#文件名:checkword.sh
word=$1
grep "^$1$" /usr/share/dict/linux.words -q
if [ $? -eq 0 ];
then
echo $word is a dictionary word;
else
echo $word is not a dictionary word;
fi

 

posted @ 2014-07-30 16:30  曹守鑫  阅读(597)  评论(0编辑  收藏  举报