shell脚本仅列出当前目录下的文件及文件夹


#!/bin/bash  
function ergodic(){
    for file in ` ls $1 `
#    do  
#        if [ -d $1"/"$file ]  
#        then  
#             ergodic $1"/"$file  
#        else  
#             wc -L $1"/"$file | cut -d' ' -f1 >> /home/huanghongbo/out  
#        fi  
#    done
    do
      echo $file
    done

}
INIT_PATH="/home/huanghongbo/"
ergodic $INIT_PATH

 

参考:

Linux shell编程 5 ---- 利用shell脚本遍历某个目录下的所有文件


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM