判断字典中是否有这个单词

#!/bin/bash
echo `ls /usr/share/dict`
s=`cat /usr/share/dict/linux.words`
for i in $s;
do
    if [ $1 = $i ];then
       echo "$1 在字典中"
       exit
    fi
done
echo "$1 不在字典中"

  

猜你喜欢

转载自www.cnblogs.com/hcy-24/p/11601973.html