vim statistic.sh
#!/bin/bash
read -p "please assign a file:" MYFILE
if [ -e $MYFILE -a -f $MYFILE ];then
let C=0
while read LINE; do
let C++
done < $MYFILE
echo "There are $C lines in $MYFILE"
else
exit 5
fi
本文转自 张玉坡 51CTO博客,原文链接:http://blog.51cto.com/fighter/463090