我需要检查是否安装了RPM软件包pptpd,忽略版本。 如果是我想删除它。 如果不是,那么检查/etc/pptpd.conf和/ etc / ppp /是否存在。 如果对于任何一个或两个是,则rm -rf。
rpm -q pptpd if [ $? = 0 ] then echo "pptpd installed.. removing" rpm -e pptp elif [ -e "/etc/pptpd.conf" ] then rm -rf /etc/pptpd.conf fi
但我不知道是否需要它删除检查存在包/文件是需要的?
这里有一个方法:
if rpm --quiet -q pptpd # check for package then # the package does exist, remove it rpm -e pptpd else # the package does not exist, so delete the files. /bin/rm -rf /etc/pptpd.conf /etc/ppp