只计算指定文件的大小


[root@usr001 ~]# cat dd.sh
#!/bin/bash
for i in du -ab /root/test/201712{01..31}/pdf/*|awk -F "[ /]+" '{print $1}' #此处有反引号
do
let SUM+=$i

done
echo "total:$SUM"
[root@usr001 ~]# sh dd.sh
total:2503312000
[root@usr001 ~]#

[root@usr001 ~]# cat dd.sh
for i in du -ab /root/test/201712{01..31}/pdf/*|awk -F "[ /]+" '{print $1}' #此处有反引号
do
let SUM+=$i

done
echo "total:$SUM">>/tmp/tst.txt
[root@usr001 ~]#