[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#28682: Possible bug in conflict between -m and -A
From: |
Jesse Eedrah |
Subject: |
bug#28682: Possible bug in conflict between -m and -A |
Date: |
Tue, 3 Oct 2017 01:00:14 -0500 |
Hi there! I have potentially found a suprising result when I use the grep
options -m and -A together. It surprised me, so let me know if I've found a
bug. It would be nice if I could contribute a fix - I'd love to contribute
to the project.
Below is bash code to replicate.
Best regards,
Jesse
#############
#! /bin/bash
test='1 Hello
2 Hello
3 Hello
4 World
5 World
6 World
7 Hello
8 World'
[[ $( echo "$test" | grep -m 2 Hello | cat ) == '1 Hello
2 Hello' ]] && echo Pass || echo Fail
[[ $( echo "$test" | grep -A 2 Hello | cat ) == '1 Hello
2 Hello
3 Hello
4 World
5 World
--
7 Hello
8 World' ]] && echo Pass || echo Fail
[[ $( echo "$test" | grep -A 3 -m 3 Hello | cat ) == '1 Hello
2 Hello
3 Hello
4 World
5 World
6 World' ]] && echo Pass || echo Fail
[[ $( echo "$test" | grep -A 3 -m 2 Hello | cat ) == '1 Hello
2 Hello
3 Hello
4 World
5 World
6 World' ]] && echo Pass || echo Fail
echo Actually outputs:
echo "$test" | grep -A 3 -m 2 Hello | cat
- bug#28682: Possible bug in conflict between -m and -A,
Jesse Eedrah <=