zstdgrep: Handle -f Flag

This commit is contained in:
W. Felix Handte 2019-05-24 16:55:59 -04:00
parent ff0be17cf7
commit 61025d5b7d

View File

@ -58,6 +58,9 @@ while [ "$#" -gt 0 ] && [ "${endofopts}" -eq 0 ]; do
shift 2 shift 2
break break
;; ;;
-f)
pattern_found=2
;;
*) *)
;; ;;
esac esac
@ -117,7 +120,11 @@ else
set -f set -f
while [ "$#" -gt 0 ]; do while [ "$#" -gt 0 ]; do
# shellcheck disable=SC2086 # shellcheck disable=SC2086
if [ $pattern_found -eq 2 ]; then
"${zcat}" -fq -- "$1" | "${grep}" --label="${1}" ${grep_args} -- -
else
"${zcat}" -fq -- "$1" | "${grep}" --label="${1}" ${grep_args} -- "${pattern}" - "${zcat}" -fq -- "$1" | "${grep}" --label="${1}" ${grep_args} -- "${pattern}" -
fi
[ "$?" -ne 0 ] && EXIT_CODE=1 [ "$?" -ne 0 ] && EXIT_CODE=1
shift shift
done done