- 论坛徽章:
- 0
|
#! /bin/bash
echo "the command will analysis all the c file in this directory"
echo "would you sure to execute the command ? [yes] to execute,[no] to exit"
read input
fileCnt=0
if [ $input="yes" ]; then
fileCnt=`echo *.c | awk '{ print NF }'`
#fileCnt=$(($fileCnt-1))
echo "the total c file is $fileCnt"
if [ "$fileCnt" -ge 1 ]; then
if [ $RULECLANG="chinese" ]; then
echo "the language is chinese"
`find . -name "*.c" -print | xargs rulec >chinese`
elif [ $RULECLANG="english" ]; then
echo "the language is english"
`find . -name "*.c" -print | xargs rulec > english`
else
echo "the language is japanese"
`find . -name "*.c" -print | xargs rulec > japanese`
fi
else
echo "there are no c files in the directory,please change the dir"
fi
else
echo "GoodBye"
fi
这个程序中,如果当前目录下没有.C文件的时候,fileCnt的值为什么是1呢?如果当前目录下有.C文件的时候,计算的就是对的,不明白的说~~给讲讲~ |
|