#! /bin/sh
if [ $# -lt 1 ]
then echo '请填写路径'
exit
fi
{
function e(){
for file in `ls $1`
do
if [ -d $1"/"$file ]
then
e $1"/"$file $2
else
echo -e $1"/"$file"\n"
fi
done
}
}
e $1 $2
#! /bin/sh
if [ $# -lt 1 ]
then echo '请填写路径'
exit
fi
{
function e(){
for file in `ls $1`
do
if [ -d $1"/"$file ]
then
e $1"/"$file $2
else
echo -e $1"/"$file"\n"
fi
done
}
}
e $1 $2
本文标题:我的第一个shell脚本, 遍历文件夹下所有文件(包含子目录)
本文链接:https://www.haomeiwen.com/subject/spbjdqtx.html
网友评论