Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F164071913
D23549.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D23549.diff
View Options
Index: usr.bin/grep/zgrep.sh
===================================================================
--- usr.bin/grep/zgrep.sh
+++ usr.bin/grep/zgrep.sh
@@ -29,6 +29,7 @@
zcat=zstdcat
endofopts=0
+pattern=""
pattern_found=0
grep_args=""
hyphen=0
@@ -83,10 +84,7 @@
fi
case $1 in
-e)
- pattern="$2"
pattern_found=1
- shift 2
- break
;;
*)
;;
@@ -143,15 +141,24 @@
if [ $# -lt 1 ]
then
# ... on stdin
+ if [ -z "${pattern}" ]; then
+ ${cattool} ${catargs} - | ${grep} ${grep_args} - || ret=$?
+ else
${cattool} ${catargs} - | ${grep} ${grep_args} -- "${pattern}" - || ret=$?
+ fi
else
# ... on all files given on the command line
if [ ${silent} -lt 1 -a $# -gt 1 ]; then
grep_args="-H ${grep_args}"
fi
for file; do
- ${cattool} ${catargs} -- "${file}" |
- ${grep} --label="${file}" ${grep_args} -- "${pattern}" - || ret=$?
+ if [ -z "${pattern}" ]; then
+ ${cattool} ${catargs} -- "${file}" |
+ ${grep} --label="${file}" ${grep_args} - || ret=$?
+ else
+ ${cattool} ${catargs} -- "${file}" |
+ ${grep} --label="${file}" ${grep_args} -- "${pattern}" - || ret=$?
+ fi
done
fi
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Jul 29, 11:43 AM (12 h, 10 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
35697281
Default Alt Text
D23549.diff (1 KB)
Attached To
Mode
D23549: zgrep: Allow multiple options '-e'
Attached
Detach File
Event Timeline
Log In to Comment