--- /usr/bin/pkg-size.orig 2004-01-27 19:25:17.000000000 -0500 +++ /usr/bin/pkg-size.orig 2004-02-01 05:15:25.000000000 -0500 @@ -48,12 +48,16 @@ pkgname=`echo $file | sed -e "s:\/var\/db\/pkg\/::" -e "s:\/CONTENTS::"` -totals=`cat $file|grep "obj"|awk '{ print $2 }' | sed "s/ /\\ /" | xargs du -scb | grep total | cut -f 1` +contents=`cat $file|grep "obj"|awk '{ print $2 }' | sed "s/ /\\ /"` size=0 -for i in $totals ; do - size=$[size+i] -done + +if [ ! -z "$contents" ] ; then + totals=`echo $contents | xargs du -scb | grep total | cut -f 1` + for i in $totals ; do + size=$[size+i] + done +fi echo "$pkgname $size ($[size/1024]KB)"