Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 23 Sep 2015 09:58:51 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-bugs@FreeBSD.org
Subject:   [Bug 203279] /bin/expr operator : fails when the string has a leading hyphen.
Message-ID:  <bug-203279-8@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=203279

            Bug ID: 203279
           Summary: /bin/expr operator : fails when the string has a
                    leading hyphen.
           Product: Base System
           Version: 10.2-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: bin
          Assignee: freebsd-bugs@FreeBSD.org
          Reporter: egilb@ife.no

expr on other *NIX versions seems to handle a leading hyphen in the text
string.
On FreeBSD, the hyphen is parsed as an illegal option:

/bin/expr '-XXabs' : '.*\(aa*\)'
expr: illegal option -- X
expr: usage: expr [-e] expression

A trivial workaround is to use grouping:

/bin/expr \( '-XXabs' : '.*\(aa*\)' \)
a

-- 
You are receiving this mail because:
You are the assignee for the bug.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-203279-8>