用户名: 密码: 忘记密码? 注册

count_line.sh

作者:  时间: 2010-12-17
显示文件行数
 
 

#!/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