> On Aug 29, 2020, at 8:41 PM, Bruce Lilly <[email protected]> wrote:
>
>> On Sat, Aug 29, 2020 at 4:53 PM Koichi Murase <[email protected]> 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