[jboss-jira] [JBoss JIRA] (WFCORE-3556) Unexpected output with grep '^no\(fork\|group\)'

Marek Marusic (JIRA) issues at jboss.org
Mon Feb 12 07:32:00 EST 2018


    [ https://issues.jboss.org/browse/WFCORE-3556?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13531643#comment-13531643 ] 

Marek Marusic edited comment on WFCORE-3556 at 2/12/18 7:31 AM:
----------------------------------------------------------------

It looks like the problem is caused because of the escape characters.

I tried it with *grep command in linux bash* environment :
$ echo nofork | grep '^no(fork|group)'   #no output, since characters (|) are not escaped.

$ echo nofork | grep '^no\(fork\|group\)' #finds the match, since characters (|) are escaped.
nofork

\\

And then I tried it with the *grep* command from *aesh-extensions* the behaviour is exactly opposite:
\[aesh at extensions\] $ echo nofork | grep '^no\(fork\|group\)'   #no match
\[aesh at extensions\] $ echo nofork | grep '^no(fork|group)' #finds a match
nofork

\\
Do  you [~kanovotn] [~jdenise] think this is wrong behaviour and the grep from aesh-extensions should behave exactly the same as the bash and therefore it should expect the escaped regex *'^no\(fork\|group\)'* ?



was (Author: mmarusic):
It looks like the problem is caused because of the escape characters.

I tried it with *grep command in linux bash* environment :
$ echo nofork | grep '^no(fork|group)'   #no output, since characters (|) are not escaped.

$ echo nofork | grep '^no\(fork\|group\)' #finds the match, since characters (|) are escaped.
nofork



And then I tried it with the *grep* command from *aesh-extensions* the behaviour is exactly opposite:
\[aesh at extensions\] $ echo nofork | grep '^no\(fork\|group\)'   #no match
\[aesh at extensions\] $ echo nofork | grep '^no(fork|group)' #finds a match
nofork


Do  you [~kanovotn] [~jdenise] think this is wrong behaviour and the grep from aesh-extensions should behave exactly the same as the bash and therefore it should expect the escaped regex *'^no\(fork\|group\)'* ?


> Unexpected output with grep '^no\(fork\|group\)'
> ------------------------------------------------
>
>                 Key: WFCORE-3556
>                 URL: https://issues.jboss.org/browse/WFCORE-3556
>             Project: WildFly Core
>          Issue Type: Bug
>          Components: CLI
>            Reporter: Katerina Novotna
>            Assignee: Jean-Francois Denise
>
> *Description of problem:*
> Aesh grep command doesn't return expected result. The same command with bash grep gives 'nofork' result.
> *Actual results:*
> [standalone at embedded /] echo nofork | grep '^no\(fork\|group\)'
> [standalone at embedded /] 
> *Expected results:*
> [standalone at embedded /] echo nofork | grep '^no\(fork\|group\)'
> [standalone at embedded /] nofork



--
This message was sent by Atlassian JIRA
(v7.5.0#75005)


More information about the jboss-jira mailing list