#!/bin/bash

function echofile(){
        if [[ ! $1 =~ \.log$ ]];then
                echo $1
        fi
}

function getdir(){
    for item in `ls $1`
    do
        filename=$1"/"$item
        if [[ -d $filename ]]
        then
            echo $filename
            getdir $filename
        else
            echofile $filename
        fi
    done
}
root_dir="$1"
getdir $root_dir

参考:
https://blog.csdn.net/wdz306ling/article/details/81181699

Logo

更多推荐