Korn shell script counts different file

profileJack Jonshen
filecounttestsession.txt

$ filecount /etc /etc: 153 ordinary 3 executable 7 links 124 directories $ echo $? 0 $ filecount /dev /dev: 170 ordinary 0 executable 8 links 17 directories $ echo $? 0 $ filecount / /: 1 ordinary 0 executable 0 links 20 directories $ echo $? 0 $ filecount /etc /dev / /etc: 153 ordinary 3 executable 7 links 124 directories /dev: 170 ordinary 0 executable 8 links 17 directories /: 1 ordinary 0 executable 0 links 20 directories $ echo $? 0 $ cd / $ filecount .: 1 ordinary 0 executable 0 links 20 directories $ echo $? 0 $ filecount -f -x -l -d .: 1 ordinary 0 executable 0 links 20 directories $ echo $? 0 $ filecount -f -x -l -d / /: 1 ordinary 0 executable 0 links 20 directories $ echo $? 0 $ filecount -l -d -x -f / /dev /: 1 ordinary 0 executable 0 links 20 directories /dev: 170 ordinary 0 executable 8 links 17 directories $ echo $? 0 $ filecount -z filecount: Illegal option -- z Usage: filecount [-dflx] [directory ...] $ echo $? 1 $ filecount -f / -z /dev /: 1 ordinary filecount: Invalid directory: -z $ echo $? 2 $ filecount -x /bin /bin: 22 executable $ echo $? 0 $ filecount -l /usr/bin /usr/bin: 459 links $ echo $? 0 $ filecount -f -x /usr/sbin /usr/sbin: 10 ordinary 445 executable $ echo $? 0 $ filecount -f /usr/include /usr/include: 130 ordinary $ echo $? 0 $ filecount -f /usr/include /usr/lib /usr/include: 130 ordinary /usr/lib: 15 ordinary $ echo $? 0 $ filecount -l .: 0 links $ echo $? 0 $ filecount . .: 1 ordinary 0 executable 0 links 20 directories $ echo $? 0 $ cd /etc $ filecount -l -d -f .: 153 ordinary 7 links 124 directories $ echo $? 0 $ filecount -f -x /usr/include /usr/sbin/ /usr/include: 130 ordinary 0 executable /usr/sbin/: 10 ordinary 445 executable $ echo $? 0 $ filecount /lost filecount: Invalid directory: /lost $ echo $? 2 $ filecount / /lost /: 1 ordinary 0 executable 0 links 20 directories filecount: Invalid directory: /lost $ echo $? 2 $ filecount /lost / filecount: Invalid directory: /lost $ echo $? 2 $ filecount /usr/bin/grep filecount: Invalid directory: /usr/bin/grep $ echo $? 2 $ filecount /u* /usr: 0 ordinary 0 executable 1 links 11 directories $ echo $? 0 $ filecount /bin /bin: 0 ordinary 22 executable 112 links 0 directories $ echo $? 0 $ filecount /b* /bin: 0 ordinary 22 executable 112 links 0 directories /boot: 19 ordinary 0 executable 3 links 3 directories $ echo $? 0 $ filecount /usr/include/s* filecount: Invalid directory: /usr/include/sched.h $ echo $? 2 $ filecount -z -z filecount: Illegal option -- z Usage: filecount [-dflx] [directory ...] $ echo $? 1 $ filecount -f -f /usr/lib /usr/lib: 15 ordinary $ echo $? 0 $ filecount -f /usr/lib/ /usr/sbin/ -f /usr/lib/: 15 ordinary /usr/sbin/: 10 ordinary filecount: Invalid directory: -f $ echo $? 2 $ filecount -f -x -- .: 153 ordinary 3 executable $ echo $? 0 $ filecount -f -x -- -somedir filecount: Invalid directory: -somedir $ echo $? 2 $ filecount -f -x -- / -somedir /: 1 ordinary 0 executable filecount: Invalid directory: -somedir $ echo $? 2