IFS=":"
count=0; nonex=0
for directory in $PATH;do
if [ -d "$directory" ];then
for file in "$directory"/*;do
if [ -x "$file" ];then
count="$(($count+1))"
else
nonex="$(($nonex+1))"
fi
done
fi
done
echo "$count commands,and $nonex entries that weren't execuable"
exit 0
运行结果