Cringe, that script could definitely use some heavy refactoring.

Attached please find an attempt to rewrite the main loop.  Somebody
should probably take the time to fix the option processing too. There is
some heavy refactoring in there, in order to make the main loop small
and neat.  It's not terribly efficient (note the addition of a second
egrep "." ...) but that's error handling in shell scripts for you.

The exit code is 0 if a match is found in any file, and 1 otherwise.

I would like to also make it trap the case when the first argument isn't
a valid zipfile, and some sort of warning that -h cannot usefully be
combined with -l, but I think I've already spent more time than I
budgeted ...

This is a complete script, not a proper patch.  Feel free to generate a
diff against the current sources if you have them; I just took a copy of
/usr/bin/zipgrep and started editing.


** Attachment added: "Basically a rewrite of /usr/bin/zipgrep (still TODO: sane 
option processing)"
   http://launchpadlibrarian.net/9520555/zipgrep

-- 
zipgrep: exit code always 0
https://bugs.launchpad.net/bugs/135086
You received this bug notification because you are a member of Ubuntu
Bugs, which is the bug contact for Ubuntu.

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to