bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to match regex in bash? (any character)


From: Peng Yu
Subject: Re: How to match regex in bash? (any character)
Date: Thu, 29 Sep 2011 08:48:07 -0500

On Thu, Sep 29, 2011 at 7:22 AM, Greg Wooledge <wooledg@eeg.ccf.org> wrote:
> On Wed, Sep 28, 2011 at 12:43:01PM -0800, Roger wrote:
>> Seems I used 'man regex' as well here.  AKA regex(3).  But I did
>> realize this a few weeks ago; the real regex description being 'man 7 regex'.
>> The Bash Manual Page denotes only regex(3).
>
> You're relatively fortunate that it's *that* easy to find on Linux.  On
> Linux, regex(3) points directly to regex(7), and you're done.
>
> On HP-UX, regex(3X) points to regcomp(3C) which points to regexp(5) which
> contains the actual definitions.
>
> On OpenBSD, regex(3) doesn't even *have* a SEE ALSO section; it's a dead
> end.  And regcomp(3) is the same page as regex(3), so that doesn't help
> either.  One would have to backtrack entirely, perhaps to grep(1).
> However, buried deep in the regex(3) page is a reference to re_format(7)
> (not even boldface).  And re_format(7) has the definitions, but getting
> there takes perseverance.  (For the record, grep(1) does point straight
> to re_format(7).)
>
> So you see, bash(1) *cannot* just link directly to regex(7), because
> that's not actually the correct final destination on most operating
> systems.  It's only correct on Linux.  Bash uses the regex(3) library
> interface, so that is the correct place for bash to refer the reader.

Therefore, either bash manpage should specify clearly which regex
manpage it should be in each system (which a bad choice, because there
can be a large number of systems), or the bash manpage should omit all
the non consistent reference and say something like "see more details
in info" or something else that is platform independent. Referring to
regex(3) without any quantification is not a very good choice .

-- 
Regards,
Peng



reply via email to

[Prev in Thread] Current Thread [Next in Thread]