#!/bin/bash declare -i total=0 for line in `ls *.sh` do total+=`ls -l $line | awk '{print $5}'` done echo "所有 sh 文件的总大小为: $total 字节"