Dear Vpi,
              Yes I know this "rpm -qa | grep -q $pkg" but this part  I am
not sure [ $? -eq 0 ] && echo $pkg is present || echo $pkg is not present  ?

Regards,
Frwa.


On Tue, Aug 27, 2013 at 12:41 AM, [email protected] <[email protected]
> wrote:

> On 08/26/2013 06:35 PM, frwa onto wrote:
> > Dear Vpi,
> >              I tried
> > pkg=pfring; rpm -qa | grep -q $pkg ; [ $? -eq 0 ] && echo $pkg is
> present || echo $pkg is not present . So this script I can just put pfring
> right ? Ok first the rpm -qa | grep -q $pkg . What is [ $? -eq 0 ] doing ?
>  What is the difference with the next script? Thank you.
> >
>
> frwa,
>
> the command "rpm -qa | grep -q $pkg" is just the standard way to look for
> a rpm pkg in a rpm based distro; for more see the rpm command manual ;)
>
> about the bash exit status see this:
> http://tldp.org/LDP/abs/html/exit-status.html
>
> ciao
> -v
>
> > Regards,
> > Frwa.
> >
> >
> > On Tue, Aug 27, 2013 at 12:20 AM, [email protected] <mailto:
> [email protected]> <[email protected] <mailto:[email protected]>>
> wrote:
> >
> >     On 08/26/2013 06:06 PM, frwa onto wrote:
> >     > Dear Vpi,
> >     >              I tried this pkg=pfring; rpm -qa | grep -q $pkg ; [
> $? -eq 0 ] && echo ok, $pkg removed || echo $pkg
> >     > and gave me this pfring
> >
> >     yes you;re right, since the pfring package is not installed anymore,
> the $? == 1 and then the if statement takes the || clausole
> >     so I believe the pfring is already uninstalled.
> >
> >     for the record, if you want to check if a pkg is present (or not)
> use something like this:
> >
> >     pkg=pkg_name; rpm -qa | grep -q $pkg ; [ $? -eq 0 ] && echo $pkg is
> present || echo $pkg is not present
> >
> >     or even simpler
> >
> >     pkg=pkg_name; rpm --quiet -q $pkg ; [ $? -eq 0 ] && echo $pkg is
> present || echo $pkg is not present
> >     (this will work but you have to use the exact name of the package,
> so I usually prefer the former)
> >
> >     I know this is a lot convolute, but it could be used in a script ;)
> >
> >     ciao
> >     -v
> >
> >     >
> >     > Regards,
> >     > Frwa.
> >     >
> >     >
> >     > On Mon, Aug 26, 2013 at 11:59 PM, [email protected] <mailto:
> [email protected]> <mailto:[email protected] <mailto:
> [email protected]>> <[email protected] <mailto:[email protected]>
> <mailto:[email protected] <mailto:[email protected]>>> wrote:
> >     >
> >     >     On 08/26/2013 05:45 PM, frwa onto wrote:
> >     >     > Dear Vpi,
> >     >     >              This command is not showing anything rpm -ev
> $(rpm -qa | grep pfring) ?
> >     >
> >     >     In case of success it wont produces any messages; if you want
> more verbosity use something like this:
> >     >
> >     >     rpm -evH $(....
> >     >
> >     >     -btw: you can test the bash exit status from the previous
> command, see [1]
> >     >
> >     >     for example
> >     >
> >     >     pkg=pfring; rpm -qa | grep -q $pkg ; [ $? -eq 0 ] && echo ok,
> $pkg removed || echo $pkg not found, perhaps already removed?
> >     >
> >     >     ciao
> >     >     vito
> >     >
> >     >
> >     >     [1] http://tldp.org/LDP/abs/html/exit-status.html
> >     >
> >     >     >
> >     >     > Regards,
> >     >     > Frwa.
> >     >     >
> >     >     >
> >     >     > On Mon, Aug 26, 2013 at 11:41 PM, [email protected]<mailto:
> [email protected]> <mailto:[email protected] <mailto:
> [email protected]>> <mailto:[email protected] <mailto:
> [email protected]> <mailto:[email protected] <mailto:
> [email protected]>>> <[email protected] <mailto:[email protected]>
> <mailto:[email protected] <mailto:[email protected]>> <mailto:
> [email protected] <mailto:[email protected]> <mailto:
> [email protected] <mailto:[email protected]>>>> wrote:
> >     >     >
> >     >     >     Dear frwa,
> >     >     >
> >     >     >     I think you've installed the pf_ring rpm without using
> yum, so just type:
> >     >     >
> >     >     >     rpm -ev $(rpm -qa | grep pfring)
> >     >     >
> >     >     >     regards
> >     >     >     -v
> >     >     >
> >     >     >     On 08/26/2013 05:32 PM, frwa onto wrote:
> >     >     >     > Dear All,
> >     >     >     >             I have installed pf_ring using the yum
> method previously. Now I want to remove it so I ran and got this.
> >     >     >     >
> >     >     >     > yum remove pfring* -y
> >     >     >     > Loaded plugins: fastestmirror, security
> >     >     >     > Setting up Remove Process
> >     >     >     > No Match for argument: pfring-5.5.3-6016.x86_64.rpm
> >     >     >     > Loading mirror speeds from cached hostfile
> >     >     >     >  * base: centos.mirror.iweb.ca <
> http://centos.mirror.iweb.ca> <http://centos.mirror.iweb.ca> <
> http://centos.mirror.iweb.ca> <http://centos.mirror.iweb.ca>
> >     >     >     >  * extras: centos.mirror.iweb.ca <
> http://centos.mirror.iweb.ca> <http://centos.mirror.iweb.ca> <
> http://centos.mirror.iweb.ca> <http://centos.mirror.iweb.ca>
> >     >     >     >  * updates: centos.mirror.iweb.ca <
> http://centos.mirror.iweb.ca> <http://centos.mirror.iweb.ca> <
> http://centos.mirror.iweb.ca> <http://centos.mirror.iweb.ca>
> >     >     >     > No Packages marked for removal
> >     >     >     >
> >     >     >     > How to resolve this cause my pf_ring is still there? I
> want to install it from source now cause too many issue with the .rpm
> version.
> >     >     >     >
> >     >     >     >
> >     >     >     > _______________________________________________
> >     >     >     > Ntop-misc mailing list
> >     >     >     > [email protected] <mailto:
> [email protected]> <mailto:[email protected]<mailto:
> [email protected]>> 
> <mailto:[email protected]<mailto:
> [email protected]> <mailto:[email protected]<mailto:
> [email protected]>>>
> >     >     >     > http://listgateway.unipi.it/mailman/listinfo/ntop-misc
> >     >     >     >
> >     >     >
> >     >     >     _______________________________________________
> >     >     >     Ntop-misc mailing list
> >     >     >     [email protected] <mailto:
> [email protected]> <mailto:[email protected]<mailto:
> [email protected]>> 
> <mailto:[email protected]<mailto:
> [email protected]> <mailto:[email protected]<mailto:
> [email protected]>>>
> >     >     >     http://listgateway.unipi.it/mailman/listinfo/ntop-misc
> >     >     >
> >     >     >
> >     >     >
> >     >     >
> >     >     > _______________________________________________
> >     >     > Ntop-misc mailing list
> >     >     > [email protected] <mailto:
> [email protected]> <mailto:[email protected]<mailto:
> [email protected]>>
> >     >     > http://listgateway.unipi.it/mailman/listinfo/ntop-misc
> >     >     >
> >     >
> >     >     _______________________________________________
> >     >     Ntop-misc mailing list
> >     >     [email protected] <mailto:
> [email protected]> <mailto:[email protected]<mailto:
> [email protected]>>
> >     >     http://listgateway.unipi.it/mailman/listinfo/ntop-misc
> >     >
> >     >
> >     >
> >     >
> >     > _______________________________________________
> >     > Ntop-misc mailing list
> >     > [email protected] <mailto:
> [email protected]>
> >     > http://listgateway.unipi.it/mailman/listinfo/ntop-misc
> >     >
> >
> >     _______________________________________________
> >     Ntop-misc mailing list
> >     [email protected] <mailto:
> [email protected]>
> >     http://listgateway.unipi.it/mailman/listinfo/ntop-misc
> >
> >
> >
> >
> > _______________________________________________
> > Ntop-misc mailing list
> > [email protected]
> > http://listgateway.unipi.it/mailman/listinfo/ntop-misc
> >
>
> _______________________________________________
> Ntop-misc mailing list
> [email protected]
> http://listgateway.unipi.it/mailman/listinfo/ntop-misc
>
_______________________________________________
Ntop-misc mailing list
[email protected]
http://listgateway.unipi.it/mailman/listinfo/ntop-misc

Reply via email to