Skip to content

Commit 8f79df3

Browse files
authored
grep: fix -Fc regression (#634)
* Combining -F and -c flags had the incorrect result of showing matching lines followed by a count * When debugging this I discovered the opt hash was supposed to be massaged so s-flag is set if c-flag is set
1 parent 26d0db3 commit 8f79df3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

bin/grep

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ sub parse_args {
147147
@opt{ split //, $nulls } = ('') x length($nulls);
148148

149149
getopts( $optstring, \%opt ) or usage();
150+
$opt{'s'} = 1 if $opt{'c'};
150151

151152
my $no_re = $opt{F} || ( $Me =~ /\bfgrep\b/ );
152153
$match_code = '';
@@ -243,7 +244,6 @@ sub parse_args {
243244
$opt{1} += $opt{l}; # that's a one and an ell
244245
$opt{H} += $opt{u};
245246
$opt{c} += $opt{C};
246-
$opt{'s'} += $opt{c};
247247
$opt{1} += $opt{'s'} && !$opt{c}; # that's a one
248248

249249
@ARGV = ( $opt{r} ? '.' : '-' ) unless @ARGV;

0 commit comments

Comments
 (0)