Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I need to check whether the RPM package pptpd is installed, ignoring the version. If it is I want to remove it. If not then check whether /etc/pptpd.conf and /etc/ppp/ exist. If yes for any or both then rm -rf.

share|improve this question

2 Answers 2

up vote 2 down vote accepted
rpm -q pptpd
if [ $? = 0 ]
echo "pptpd installed.. removing"
rpm -e pptp
elif [ -e "/etc/pptpd.conf" ]
rm -rf /etc/pptpd.conf

But I wonder if you need it removed checking for the existence package/file is needed ?

share|improve this answer

Here's one way:

if rpm --quiet -q pptpd    # check for package
   # the package does exist, remove it
   rpm -e pptpd
   # the package does not exist, so delete the files.
   /bin/rm -rf /etc/pptpd.conf /etc/ppp
share|improve this answer
well done both working fine one more thing if i want to display echo ip that assigned to eth1 any statement could help ? – user47556 Oct 27 '10 at 10:17
I suggest you start a new question. Besides getting more answers, you will improve your point standing. – kmarsh Oct 27 '10 at 12:39

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.