【发布时间】:2014-04-04 15:45:16
【问题描述】:
这是我到目前为止的代码:
echo $(pwd > adress)
var=$(head -1 adress)
rm adress
found=0 #Flag
fileshow()
{
cd $1
for i in *
do
if [ -d $i ]
then
continue
elif [ -w $i ]
then
echo $i
found=1
fi
done
cd ..
}
fileshow $1
if [ $found -eq 0 ]
then
clear
echo "$(tput setaf 1)There arent any executable files !!!$(tput sgr0)"
fi
它可以工作,但它只在当前目录中查找文件。
有人告诉我,我需要使用某种递归方法来遍历所有子目录,但我不知道该怎么做。
如果有人可以帮助我,我将非常感激。
谢谢!
【问题讨论】: