没基础,写的比较2...
#!/bin/sh
total=0
udr='/ldata/fuse-udr-split/'
logfile='/home/xxxx/total.log'
rm ${logfile}
for dire in `ls ${udr}`
do
diry=${udr}${dire}
echo ${diry}
if [ -d ${diry} ]
then
cd ${diry}
for file in `ls`
do
if [ -f ${file} ]
then
b=`wc -l ${file} | awk -F' ' '{print $1}'`
total=`expr $total + $b`
fi
done
echo "${diry}:${total}"
echo "${diry}:${total}">>${logfile}
fi
done