count_line.sh

显示文件行数
 
 

#!/bin/bash

read -p "Please assign a file:" FILE
let COUNT=0

if ls -dl $FILE | grep "^-.*" > /dev/null;then
 while read LINE; do
   let COUNT++
   done < $FILE
   echo $COUNT
else
  echo "The \"FILE\" is not a common file. "

fi

 

作者: xyqcuijia   发布时间: 2010-12-17