#!/bin/bash #summing sizes by converting to an array and using the array index TOT=0 for FILE in $@ do if [[ -x $FILE && -f $FILE ]] then ADET=( `ls -l $FILE` ) TOT=$(( $TOT + ${ADET[4]} )) echo $FILE ${ADET[4]} ((CNT++)) fi done echo $TOT