LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 05-01-2010, 02:11 PM   #1
linuxment
LQ Newbie
 
Registered: Apr 2010
Posts: 1

Rep: Reputation: 0
rpm shell script


hi all

i have a input text file contain 10 rpms and they are old versions
i need a shell script to check if these rpms is installed or not and if the
newer version is installed and i need all the results in one output text file
contain every rpm and its condition ( the same) or (new )or( not installed)

thanks in advance.
 
Old 05-01-2010, 02:53 PM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 17,950

Rep: Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693
Quote:
Originally Posted by linuxment View Post
hi all

i have a input text file contain 10 rpms and they are old versions
i need a shell script to check if these rpms is installed or not and if the
newer version is installed and i need all the results in one output text file
contain every rpm and its condition ( the same) or (new )or( not installed)

thanks in advance.
Ok, so what's your question?? You've told us what you want....if you're having trouble with a script you wrote, post it, and tell us where you're having problems, and we'll be glad to help. Be sure to tell us what version/distro of Linux, sample file(s), and your complete script as it exists so far.

If you are expecting someone to write this for you, you're in the wrong place.
 
Old 05-01-2010, 03:02 PM   #3
kirukan
Senior Member
 
Registered: Jun 2008
Location: Eelam
Distribution: Redhat, Solaris, Suse
Posts: 1,272

Rep: Reputation: 148Reputation: 148
I hope, we can suggest to use yum, apt-get, etc. instead of this scripting

Last edited by kirukan; 05-01-2010 at 03:08 PM.
 
Old 05-01-2010, 03:06 PM   #4
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295
Hello and welcome to LinuxQuestions,

Is this by any chance homework? It sure sounds like it. Like TB0ne said, show us what you have written already and where it's failing and we might point you in the right direction. If you're starting out with scripting, read these guides:

Bash Guide for Beginners
Advanced Bash Scripting Guide

Kind regards,

Eric
 
Old 04-11-2012, 12:42 PM   #5
kneetin
LQ Newbie
 
Registered: Mar 2011
Posts: 1

Rep: Reputation: 0
Hello Everyone,

As i have writen a script which check the rpm installed or not.

But instead of enter single rpm i want a file input in which all rpms list which need to check.

Please help. thanks in advance

#!/bin/bash -

uname -rv
bash --version
rpm --version

echo
P=${1?" must specify package name."}

rpm -qa "$P" > t1
my_size=$( wc -l < t1 )
echo " Size of report file is $my_size lines"

if [[ $( rpm -qa $P ) =~ ${P} ]]
# if [[ $( rpm -qa $P ) == *${P}* ]]
then
echo " Package $P is installed."
else
echo " Package $P not found."
fi

exit 0
 
  


Reply


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
Executing a Shell script with 654 permissions inside another shell script. changusee2k Linux - Newbie 2 06-07-2011 08:58 PM
How to create a RPM from a Shell script bipinkdas Fedora 1 03-21-2007 02:52 AM
how does a rpm build happen + shell script help sailu_mvn Linux - Software 38 07-21-2006 03:40 AM
accepting root passwd from UI and passing it to a shell script to extract a rpm rameshvl Linux - Software 4 03-18-2003 01:11 AM


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

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