命令格式如下:
SCRIPT_NAME SEARCH_ON_DIR SEARCH_FILENAME
#!/bin/bash
Find(){
echo $" "$
files=`ls $`
for file in $files
do
if [ -d $"/"$file ]
then
Find $"/"$file $ `expr $ + `
elif [ $file=$ ]
then
echo $"/"$
fi
done
}
FindFile(){
if [ -d $ ]
then
Find $ $
else
echo "This is not a directory or does not exist"
fi
}
echo "Start finding $2 in $1"
FindFile $ $
基本实现简单查找功能,编写代码时应格外注意语法格式