1、根据文件名查找文件
#!/bin/bash
findFile(){
find / -name "$1"
}
findFile $1
2、根据文件夹名递归删除文件夹(防止rm -rf误删所有)
#!/bin/bash
rmFolder() {
folderName=$1
len=${#folderName}
if [ ${len} -ne 0 ]
then
if [ -d $1 ]
then
rm -rf $1
else
echo "Please enter the correct folder name!"
fi
else
echo "Please enter the deleted folder name!"
fi
}
rmFolder $1