# shell脚本=间不能有空格
file_type=('*.py' '*.txt')
parent_path='/path/to/dir'
all=0
for ftype in "${file_type[@]}"
do
num=$(find $parent_path -name $ftype | wc -l)
echo $ftype=$num
all=$(expr $all + $num)
done
echo $all
# shell脚本=间不能有空格
file_type=('*.py' '*.txt')
parent_path='/path/to/dir'
all=0
for ftype in "${file_type[@]}"
do
num=$(find $parent_path -name $ftype | wc -l)
echo $ftype=$num
all=$(expr $all + $num)
done
echo $all