Groups | Search | Server Info | Keyboard shortcuts | Login | Register
Groups > gnu.bash.bug > #16861
| From | Lawrence Velázquez <vq@larryv.me> |
|---|---|
| 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 21:12 -0400 |
| Message-ID | <mailman.1747.1598749964.2469.bug-bash@gnu.org> (permalink) |
| References | (3 earlier) <CAFLRLk9CBn1CUchi5tHmZ7FitWWpLaVc-Sxyr7=AuGRAQXWe9Q@mail.gmail.com> <CAPyES37OZ-TAjmxRp72dv97eKPzNes=__QqnBHuEK+rK78QSSg@mail.gmail.com> <CAFLRLk-WondkFshbc5=vF=20dViDyn20E7eps3rMJaog4ag7Yg@mail.gmail.com> <CAPyES34iHv0YzEjQd1me3qV2JrZ=XOgvR_Wb5SpZ=5cYWQ3-vQ@mail.gmail.com> <C4224EEC-8FBF-472A-88DF-B96BA3F1A8CB@larryv.me> |
> On Aug 29, 2020, at 8:41 PM, Bruce Lilly <bruce.lilly@gmail.com> wrote:
>
>> On Sat, Aug 29, 2020 at 4:53 PM Koichi Murase <myoga.murase@gmail.com> wrote:
>>
>> Yes, I know that it is confusing to those who are familiar with modern
>> Perl-style regular expressions. But historically, POSIX regular
>> expressions do not support the backslash escape sequences in bracket
>> expressions `[...]'. The backslash escape sequences in bracket
>> expressions were the extension historically. As far as I know, in
>> POSIX, only awk supports backslash sequences in regular expressions.
>
> Actually, it works (portably) with
> separator2=$'\057'
(a) $'...' is not POSIX. For instance, dash does not recognize it.
% port installed dash
The following ports are currently installed:
dash @0.5.11.1_0 (active)
% dash <<\EOF
heredoc> printf '<%s>\n' $'\057'
heredoc> EOF
<$\057>
(b) If you define separator2 in that way and then substitute it,
the context into which it is substituted sees a slash character,
not the backslash-escaped octal.
$ echo "$BASH_VERSION"
5.0.17(1)-release
$ printf '%s\n' $'\057'
/
vq
Back to gnu.bash.bug | Previous | Next | Find similar
Re: Bash parameter expansion (remove largest trailing match, remove largest leading match, pattern replacement) does not work Lawrence Velázquez <vq@larryv.me> - 2020-08-29 21:12 -0400
csiph-web