#!/bin/bash
cd /home/a //切换到要统计文件数目的目录
fcnt=0
dcnt=0
frcnt=0
fwcnt=0
fxcnt=0
for
file
in
*
do
if
[ -f $
file
];
then
let
fcnt+=1
if
[ -r $
file
];
then
let
frcnt+=1
fi
if
[ -w $
file
];
then
let
fwcnt+=1
fi
if
[ -x $
file
];
then
let
fxcnt+=1
fi
elif
[ -d $
file
];
then
let
dcnt+=1
fi
done
echo
"There are $fcnt files in $PWD"
echo
-e
"\tThere are $frcnt readable files in $PWD"
echo
-e
"\tThere are $fwcnt writeable files in $PWD"
echo
-e
"\tThere are $fxcnt executeable files in $PWD"
echo
"There are $dcnt directories in $PWD"