PROGRAM
#size function to find the total size of the files
size()
{
s=0
for i in $*
do
if test -f $i
then
sz=`ls -l $i|tr -s " "|cut -d " " -f5`
s=`expr $s + $sz`
else
echo $i is not a file
fi
done
return $s
}
size $*
ret=$?
echo "Total size is " $s
OUTPUT
sh sizFunc.sh fibt file fil2
fil2 is not a file
Total size is 159
No comments:
Post a Comment