#!/bin/bash # sum the sizes of the file names received from the command line # if those names correspond to files (not directories) and those files # are writable TOT=0 for FILE in $@ do if [[ -w $FILE && -f $FILE ]] then ADET=( `ls -l $FILE` ) TOT=$(( $TOT + ${ADET[4]} )) echo $FILE ${ADET[4]} ((CNT++)) fi done echo $TOT