[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bash parameter expansion (remove largest trailing match, remove larg
From: |
Lawrence Velázquez |
Subject: |
Re: Bash parameter expansion (remove largest trailing match, remove largest leading match, pattern replacement) does not work |
Date: |
Sat, 29 Aug 2020 21:12:35 -0400 |
> 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
- Re: Bash parameter expansion (remove largest trailing match, remove largest leading match, pattern replacement) does not work, (continued)
- Re: Bash parameter expansion (remove largest trailing match, remove largest leading match, pattern replacement) does not work, Koichi Murase, 2020/08/29
- Re: Bash parameter expansion (remove largest trailing match, remove largest leading match, pattern replacement) does not work, Bruce Lilly, 2020/08/29
- Re: Bash parameter expansion (remove largest trailing match, remove largest leading match, pattern replacement) does not work, Ilkka Virta, 2020/08/30
- Re: Bash parameter expansion (remove largest trailing match, remove largest leading match, pattern replacement) does not work, Chet Ramey, 2020/08/31
- Re: Bash parameter expansion (remove largest trailing match, remove largest leading match, pattern replacement) does not work, Greg Wooledge, 2020/08/31
- Re: Bash parameter expansion (remove largest trailing match, remove largest leading match, pattern replacement) does not work, Chet Ramey, 2020/08/31
- Re: Bash parameter expansion (remove largest trailing match, remove largest leading match, pattern replacement) does not work, Koichi Murase, 2020/08/29
- Re: Bash parameter expansion (remove largest trailing match, remove largest leading match, pattern replacement) does not work, Bruce Lilly, 2020/08/29
- Re: Bash parameter expansion (remove largest trailing match, remove largest leading match, pattern replacement) does not work, Koichi Murase, 2020/08/29
- Re: Bash parameter expansion (remove largest trailing match, remove largest leading match, pattern replacement) does not work, Bruce Lilly, 2020/08/29
- Re: Bash parameter expansion (remove largest trailing match, remove largest leading match, pattern replacement) does not work,
Lawrence Velázquez <=
- Re: Bash parameter expansion (remove largest trailing match, remove largest leading match, pattern replacement) does not work, Bruce Lilly, 2020/08/29
- Re: Bash parameter expansion (remove largest trailing match, remove largest leading match, pattern replacement) does not work, Robert Elz, 2020/08/30
- Re: Bash parameter expansion (remove largest trailing match, remove largest leading match, pattern replacement) does not work, Chet Ramey, 2020/08/31
- Re: Bash parameter expansion (remove largest trailing match, remove largest leading match, pattern replacement) does not work, Ángel, 2020/08/29
Re: Bash parameter expansion (remove largest trailing match, remove largest leading match, pattern replacement) does not work, Bruce Lilly, 2020/08/29
Re: Bash parameter expansion (remove largest trailing match, remove largest leading match, pattern replacement) does not work, Chet Ramey, 2020/08/31