#!/bin/bash bak_dir='/data/dbbak/' for i in `ls $bak_dir` do bak=`find ${bak_dir}${i}/ -mtime -1 -name "*.gz"` for n in $bak do size=`du -sh $n |awk -F' ' '{print $1}'` printf "%-30s%-70s %-10s " "$i的备份:" $n $size done done
#!/bin/bash bak_dir='/data/dbbak/' for i in `ls $bak_dir` do bak=`find ${bak_dir}${i}/ -mtime -1 -name "*.gz"` for n in $bak do size=`du -sh $n |awk -F' ' '{print $1}'` printf "%-30s%-70s %-10s " "$i的备份:" $n $size done done