On Monday 10 July 2006 11:35, Bernard Li wrote:
> Hi Erich:
>  
> Here's what Geoffroy wrote in his check-in log:
> 

> - to test if a package is installed or not, dpkg --status is not the best
> solution because it gives output in all cases and no output on errstd. It
> better to check the list of installed packages (dpkg -l).

Didn't see that. And the check was for the return code, not the output.
The command was:
"dpkg --status $pkgname >/dev/null 2>&1"
which means we discard all the output!

> But doing a a grep does indeed match more packages than desired.  dpkg
> --status <package> does give the correct return code though, 1 if package is
> not found and 0 if found.

Yes, I tried it before coding, too.

Regards,
Erich

> Cheers,
>  
> Bernard
> 
> ________________________________
> 
> From: [EMAIL PROTECTED] on behalf of Erich Focht
> Sent: Mon 10/07/2006 02:23
> To: [email protected]
> Cc: Geoffroy VALLEE
> Subject: Re: [Oscar-devel] [Oscar-checkins] r5114 - trunk
> 
> 
> 
> Geoffroy,
> 
> can you please explain why you replaced "dpkg --status $pkg" by
> "dpkg -l | grep $pkg" in all places?
> 
> Was --status not working for you?
> 
> Are you aware that your method is risky because "grep $pkg" can match more
> than $pkg? For example  "grep gtk" will match gtk, gtk2, gtk2-devel, etc,
> etc... That is why I consider --status the better choice, it matches exactly
> the package we want to know about.
> 
> Regards,
> Erich



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Oscar-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/oscar-devel

Reply via email to