Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 08-20-2015, 04:56 AM   #1
Registered: Mar 2012
Posts: 115

Rep: Reputation: Disabled
verify if rpm is installed

Hi Linux guru's

can you please guide me on how to create a single line command that will tell if the pogi.rpm does not exist it will echo "rpm does not exist" and if it does it will simply output the "rpm -qa | grep pogi"

I have made this, but didn't work

if [ rpm -qa | grep pogi -eq "" ]; then echo "no pogi installed" else rpm -qa | grep pogi fi
Old 08-20-2015, 06:31 AM   #2
Didier Spaier
LQ Addict
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64- on Lenovo Thinkpad W520
Posts: 9,192

Rep: Reputation: Disabled
It wouldn't hurt to learn a bit of shell scripting as this line includes several syntax errors. # the basis # explanations for bash, that is a specific shell with many added features
"man bash" # to be used as a checklist

I advise you to try using only the features provided in the POSIX specification, listed in the first document.

Last edited by Didier Spaier; 08-20-2015 at 06:37 AM.
1 members found this post helpful.
Old 08-20-2015, 07:18 PM   #3
John VV
LQ Muse
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,461

Rep: Reputation: 2604Reputation: 2604Reputation: 2604Reputation: 2604Reputation: 2604Reputation: 2604Reputation: 2604Reputation: 2604Reputation: 2604Reputation: 2604Reputation: 2604
yum will inform you with a "i" it it is installed or not

su -
yum search pogi
there will "i" if it is installed

unless this is suse
then it is "Zypper"

or it fedora 22 "DNF"
Old 08-21-2015, 10:06 AM   #4
LQ Veteran
Registered: Jan 2011
Location: Yawnstown, Ohio
Distribution: Mojave
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
rpm -aq | grep pogi > /dev/null
is what I used for this sort of processing.
Old 08-21-2015, 11:35 AM   #5
Registered: Aug 2014
Location: Leeds, England
Distribution: Slackware x86 64 current
Posts: 86

Rep: Reputation: 16
If 'pogi' is a programme you can use 'which'.
'which pogi' should give you a reply consisting of a file path to the 'pogi' executable.
If you do not have 'pogi' in your system it will reply on the lines of 'no pogi in .....'


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to verify installed slackware packages? Gary Baker Slackware 13 12-29-2014 12:55 AM
AIDE and RPM Verify FizzerJE Linux - Security 9 09-21-2010 06:22 PM
Meaning of Symlink test with rpm --verify blackhole54 Linux - General 2 01-04-2009 12:41 AM
rpm --verify -a question linuxtesting2 Red Hat 1 05-15-2004 01:39 AM
rpm --verify -a > rpmcheck.txt Question klickibunti Linux - Security 3 08-26-2002 01:39 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:51 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration