shell 遍历目录下的所有文件

dir=/usr/local/nginx/logs
 
for file in $dir/*; do
    echo $file
done
//结果
./test.sh 
/usr/local/nginx/logs/access1.log
/usr/local/nginx/logs/access.log
/usr/local/nginx/logs/error.log
/usr/local/nginx/logs/host.access.log
/usr/local/nginx/logs/logs
/usr/local/nginx/logs/nginx.pid

 

posted @ 2018-02-22 18:21  温柔的风  阅读(16544)  评论(0编辑  收藏  举报