#!/bin/bash
# This script deletes the specified template file
#Parameters passed in
temp=$1
#The purpose of this variable is concatenation
vendor=Grandstream_
#to dDir2
vendor_temp="$vendor$temp"
dDir1=/data/zeroconfig
dDir2=/data/zeroconfig/model_template/models
#delete the specified file
for i in $dDir1/*
do
if [ -d $i ]
then
if [ $i = $dDir1/$temp ]
then
rm -rf $i
break
fi
fi
done
#delete the specified file
for i in $dDir2/*
do
if [ -d $i ]
then
if [ $i = $dDir2/$vendor_temp ]
then
rm -rf $i
break
fi
fi
done
说明:
dDir1、dDir2是路径,视具体情况而定,我就要删两个路径下的内容,所以使用了两个路径
在命令行输入 xxx.sh xx
xx:你要删除的文件名称
本文介绍了一个bash脚本,用于删除指定名称的模板文件。该脚本接收一个参数作为要删除的文件名,并在两个指定目录中查找并删除匹配的文件夹。

312

被折叠的 条评论
为什么被折叠?



