travelsal all files in a dir using recursion shell

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了travelsal all files in a dir using recursion shell相关的知识,希望对你有一定的参考价值。

 

#!/bin/bash
function getdir(){
    for element in `ls $1`
    do  
        dir_or_file=$1"/"$element
        if [ -d $dir_or_file ]
        then 
            getdir $dir_or_file
        else
            echo $dir_or_file
        fi  
    done
}
root_dir="/home/test"
getdir $root_dir

 

以上是关于travelsal all files in a dir using recursion shell的主要内容,如果未能解决你的问题,请参考以下文章