遍历目录下所有的文件是目录还是文件 for file in ./* do if test -f $file then echo $file 是文件 fi if test -d $file then echo $file 是目录 fi done filelist=`ls ./proto` echo $filelist for file in $filelist;do #不能有判断if [-f $file ] ,为什么?因为文件是在当前目录的proto目录下,我们filelist输出的是文件列表,没