[Bug 203279] /bin/expr operator : fails when the string has a leading hyphen.

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Wed Sep 23 09:58:51 UTC 2015


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 at FreeBSD.org
          Reporter: egilb at 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.


More information about the freebsd-bugs mailing list