Вы можете получить исходный код изhttps://savannah.gnu.org/git/?group=gzip. Код возврата был изменен в совершатьd2a1928e5534017456dc8a3b600ba0b30cce4a6e
:
commit d2a1928e5534017456dc8a3b600ba0b30cce4a6e
Author: Paul Eggert
Date: Thu Jun 12 18:43:08 2014 -0700
zgrep: exit with status 0 if a file matches and there's no trouble
Reported by Pavel Raiskup in: http://bugs.gnu.org/17760
* zgrep.in (res): Treat exit status 0 to be greater than 1.
Also, exit immediately on software configuration error.
Сообщение о фиксации содержит ссылку на отчет об ошибке :https://debbugs.gnu.org/cgi/bugreport.cgi?bug=17760
Вы легко можете проверить это сами. С zgrep
, построенным из вышеперечисленного совершать:
$ /media/data/gzip-install-newer/bin/zgrep --version
zgrep (gzip) 1.6.17-d2a1
Copyright (C) 2010-2014 Free Software Foundation, Inc.
This is free software. You may redistribute copies of it under the terms of
the GNU General Public License .
There is NO WARRANTY, to the extent permitted by law.
Written by Jean-loup Gailly.
$ /media/data/gzip-install-newer/bin/zgrep -q abc /tmp/foo[12]
$ echo $?
0
С zgrep
, созданным из предыдущей фиксации:
$ /media/data/gzip-install/bin/zgrep --version
zgrep (gzip) 1.6.16-ed8c
Copyright (C) 2010-2014 Free Software Foundation, Inc.
This is free software. You may redistribute copies of it under the terms of
the GNU General Public License .
There is NO WARRANTY, to the extent permitted by law.
Written by Jean-loup Gailly.
$ /media/data/gzip-install/bin/zgrep -q abc /tmp/foo[12]
$ echo $?
1
Альтернативный (GNU )grep
, учитывая образец ввода:
-t -w -g london -s 'yesterday' -e 'yesterday' -f 100000"
-t -w -g london -s "yesterday" -e 'yesterday' -f 100000"
-t -w -g london -s yesterday -e yesterday -f 100000"
$ grep -oP "(?<=-s \"|-s '|-s )[^'\" ]*" file
yesterday
yesterday
yesterday