threads / patch / 33414

patchremote-helpers/test-bzr.sh: do not use grep \s

Subject: [PATCH] remote-helpers/test-bzr.sh: do not use grep \s

## tl;dr

3 messages between Apr 7, 2013 and Apr 7, 2013. Diffs are folded; open one to read it.

replies: 2people: 3as markdown or json

Torsten Bögershausen· Apr 7, 2013, 08:48 UTC · lore

Using grep "devel\s\+3:" to find at least one whitspace is not portable on all grep versions: Not all grep versions understand "\s" as a "whitespace".

Use a literal TAB followed by SPACE like this [ ] instead. The + as a qualifier for "one or more" is not a basic regular expression: use egrep instead of grep.

Signed-off-by: Torsten Bögershausen <tboegi@web.de>
---
 contrib/remote-helpers/test-hg.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Show changes to contrib/remote-helpers/test-hg.sh +1 −1
diff --git a/contrib/remote-helpers/test-hg.sh b/contrib/remote-helpers/test-hg.sh
index 5f81dfa..7bb81f2 100755
--- a/contrib/remote-helpers/test-hg.sh
+++ b/contrib/remote-helpers/test-hg.sh
@@ -115,7 +115,7 @@ test_expect_success 'update bookmark' '
   git push
   ) &&
 
-  hg -R hgrepo bookmarks | grep "devel\s\+3:"
+  hg -R hgrepo bookmarks | egrep "devel[	 ]+3:"
 '
 
 test_done
-- 
1.8.2.341.g543621f
Felipe Contreras· Apr 7, 2013, 09:02 UTC · re: Torsten Bögershausen · lore

Re: [PATCH] remote-helpers/test-bzr.sh: do not use grep \s

On Sun, Apr 7, 2013 at 3:48 AM, Torsten Bögershausen <tboegi@web.de> wrote:
Show 7 quoted lines
> Using grep "devel\s\+3:" to find at least one whitspace
> is not portable on all grep versions:
> Not all grep versions understand "\s" as a "whitespace".
>
> Use a literal TAB followed by SPACE like this [  ] instead.
> The + as a qualifier for "one or more" is not a basic regular expression:
> use egrep instead of grep.
If "\t" is not possible, I would rather use [:space:].
Cheers.
-- 
Felipe Contreras
Eric Sunshine· Apr 7, 2013, 09:04 UTC · re: Torsten Bögershausen · lore

Re: [PATCH] remote-helpers/test-bzr.sh: do not use grep \s

On Sun, Apr 7, 2013 at 4:48 AM, Torsten Bögershausen <tboegi@web.de> wrote:
> Using grep "devel\s\+3:" to find at least one whitspace
s/whitspace/whitespace/
Show 8 quoted lines
> is not portable on all grep versions:
> Not all grep versions understand "\s" as a "whitespace".
>
> Use a literal TAB followed by SPACE like this [  ] instead.
> The + as a qualifier for "one or more" is not a basic regular expression:
> use egrep instead of grep.
>
> Signed-off-by: Torsten Bögershausen <tboegi@web.de>

← back to recent threads