shell grep grep "str" file > /dev/null if [ $? -eq 1]; then echo "no str" else echo "find str" fi 输出到/dev/null中为了不打印输出