View | Details | Raw Unified | Return to bug 247126 | Differences between
and this patch

Collapse All | Expand All

(-)zgrep.sh (-3 / +17 lines)
Lines 88-93 Link Here
88
		    shift 2
88
		    shift 2
89
		    break
89
		    break
90
		    ;;
90
		    ;;
91
		-f)
92
		    # the pattern in is a file, not on the command line
93
		    pattern=""
94
		    pattern_found=1
95
		    ;;
91
		*)
96
		*)
92
		    ;;
97
		    ;;
93
	    esac
98
	    esac
Lines 143-157 Link Here
143
if [ $# -lt 1 ]
148
if [ $# -lt 1 ]
144
then
149
then
145
    # ... on stdin
150
    # ... on stdin
146
    ${cattool} ${catargs} - | ${grep} ${grep_args} -- "${pattern}" - || ret=$?
151
    if [ -n "${pattern}" ]; then
152
	${cattool} ${catargs} - | ${grep} ${grep_args} -- "${pattern}" - || ret=$?
153
    else
154
	${cattool} ${catargs} - | ${grep} ${grep_args} -- - || ret=$?
155
    fi
147
else
156
else
148
    # ... on all files given on the command line
157
    # ... on all files given on the command line
149
    if [ ${silent} -lt 1 -a $# -gt 1 ]; then
158
    if [ ${silent} -lt 1 -a $# -gt 1 ]; then
150
	grep_args="-H ${grep_args}"
159
	grep_args="-H ${grep_args}"
151
    fi
160
    fi
152
    for file; do
161
    for file; do
153
	${cattool} ${catargs} -- "${file}" |
162
	if [ -n "${pattern}" ]; then
154
	    ${grep} --label="${file}" ${grep_args} -- "${pattern}" - || ret=$?
163
	    ${cattool} ${catargs} -- "${file}" |
164
		${grep} --label="${file}" ${grep_args} -- "${pattern}" - || ret=$?
165
	else
166
	    ${cattool} ${catargs} -- "${file}" |
167
		${grep} --label="${file}" ${grep_args} -- - || ret=$?
168
	fi
155
    done
169
    done
156
fi
170
fi
157
171

Return to bug 247126