使用通配符处理目录

5年以前  |  阅读数:475 次  |  编程语言:Shell 
#!/bin/bash
#iterate through all the files in a directory
for file in /home/tiandi/test/*
do
    if [ -d "$file" ]
    then
        echo "$file is a directory"
    elif [ -f "$file" ]
    then
        echo "$file is a file"
    fi
done

Copyright© 2013-2020

All Rights Reserved 京ICP备2023019179号-8