# !/bin/bash
function echo_name()
{
#shell会执行反引号中的内容(命令)
for file in `ls $1`
do
if [ -d $1'/'$file ]
then
echo_name $1'/'$file
else
echo $1'/'$file
fi
done
}
echo_name $1
查询/app/tomcat/bin/config下的所有文件名称,若程序文件名为printfiles.sh
则在程序目录下运行:./printfiles.sh /app/tomcat/bin/config