shell/正则表达式/目录文件计数.sh

19 lines
256 B
Bash
Raw Normal View History

2016-05-18 15:54:22 +08:00
#!/bin/bash
# count number of files in your PATH
mypath=`echo $PATH | sed 's/:/ /g'`
count=0
for directory in $mypath
do
check=`ls $directory`
echo $check
for item in $check
do
count=$[ $count + 1 ]
done
echo "$directory - $count"
count=0
done