Groups | Search | Server Info | Keyboard shortcuts | Login | Register


Groups > gnu.bash.bug > #16856

Re: Bash parameter expansion (remove largest trailing match, remove largest leading match, pattern replacement) does not work

From Bruce Lilly <bruce.lilly@gmail.com>
Newsgroups gnu.bash.bug
Subject Re: Bash parameter expansion (remove largest trailing match, remove largest leading match, pattern replacement) does not work
Date 2020-08-29 16:07 -0400
Message-ID <mailman.1736.1598731677.2469.bug-bash@gnu.org> (permalink)
References <CAPyES363zNvUZHWo6imXOyC3UPU5FAbsyFGzWkcJMO-HBhT6gQ@mail.gmail.com> <CAFLRLk_k+J3-Nt9UJ4Fb8c-RewPnVjf_b=ShqGGASG0GmREAhg@mail.gmail.com> <CAPyES3685SjyZfrL+M_56wGqxvh=N9xNchWJ1xqMSrmmEJb9ww@mail.gmail.com> <CAFLRLk9CBn1CUchi5tHmZ7FitWWpLaVc-Sxyr7=AuGRAQXWe9Q@mail.gmail.com> <CAPyES37OZ-TAjmxRp72dv97eKPzNes=__QqnBHuEK+rK78QSSg@mail.gmail.com>

Show all headers | View raw


On Sat, Aug 29, 2020, 15:27 Koichi Murase <myoga.murase@gmail.com> wrote:

>  I assumed that you have written like
>
>   separator2='\057'
>   pattern1="${number1}(${separator1})"
>
> because otherwise, it doesn't work with ksh93 either.
>
You are correct.

To explain it in more detail, first, these parameter expansions work
> for me with separator1='/'.  The pattern that you constructed from
> separator2='\057' is just not supported by Bash.

That's surprising, as octal and hexadecimal escapes are fairly common.

  Next, you specify
> exactly the same script `shellbug' to both Bash and ksh93, so I could
> assume that you are missing the Bash-specific `shopt -s extglob' in
> the script because otherwise, ksh93 would have complained it.  That is
> all what I can guess from your original post.
>
Yes, I'm still looking into that (along with updating a couple of FreeBSD
machines, eating lunch, and monitoring a couple of downloads).  I'll
obviously have to wrap the "shopt" bit in a wrapper; is there some minimum
bash version that supports it?

>
>

Back to gnu.bash.bug | Previous | Next | Find similar


Thread

Re: Bash parameter expansion (remove largest trailing match, remove largest leading match, pattern replacement) does not work Bruce Lilly <bruce.lilly@gmail.com> - 2020-08-29 16:07 -0400

csiph-web