shell脚本--统计文件数量去后缀

2019-08-15  本文已影响0人  w_dll
#!/bin/bash
#date190815
read -p 'input addr:' this_addr
if [[ ! -d $this_addr ]];then
        this_addr=`pwd`
fi
rm -f 1.txt 
i=0
echo ''
ls $this_addr| egrep -v '.txt|.sh' >1.txt
cat 1.txt | while read li
do
        echo ${li%_*}
        ((++i))
done
echo -e '\ntotal files:' $i
rm -f 1.txt
上一篇 下一篇

猜你喜欢

热点阅读