#!/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
shell 检查一个单词是否在字典中
时间: 2024-10-07 10:36:21
#!/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
shell 检查一个单词是否在字典中