On Sun, 14 Oct 2007 16:07:49 +0300 George Danchev <[EMAIL PROTECTED]> wrote:
> I believe that (No packages) is fine when no selectable packages are > found, OTOH ara exists with a non-zero code when is really confised > and can't proceed, for instance ara -no_such_option ; echo $? Well "(No packages)." output helps a little, as I really hadn't noticed it. Still, the question is how *nix search utils should act. Classic example, 'grep': # look for "y" % echo yes | grep --quiet y ; echo $? 0 # look for "n" % echo yes | grep --quiet n ; echo $? 1 Those exit codes make shell scripting easy: % echo yes | grep --quiet n && echo "do stuff" || echo "don't do stuff" don't do stuff Compare that to parsing a returned string: # does any package provide a mail-reader? % [ "$(ara -list 'Provides=mail-reader')" = '(No packages).' ] && echo yes || echo no yes The string "(No packages)." is specific to 'ara', (but not mentioned in 'man ara'), so programmers unfamiliar with 'ara' must first learn how to write such code, whereas any shell programmer should already know about using exit codes. Several Debian package search utils currently lack 'true/false' exit codes: # look for a string that isn't there. % apt-cache search nyarlathotep ; echo $? 0 % feta search nyarlathotep ; echo $? Running: apt-cache search nyarlathotep 0 % wajig search nyarlathotep ; echo $? 0 But in recent years there's been some progress: % dglob nyarlathotep ; echo $? # exit code added in 2006 1 % dlocate nyarlathotep ; echo $? # exit code added in 2007 1 % dpkg-query --search nyarlathotep ; echo $? # added in ???? dpkg: *nyarlathotep* not found. 1 (I guess this should be a separate 'wishlist' bug.) HTH... -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]