Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Odd behavior with various (q) array modifiers and non-printable characters (backspace, newline)
- X-seq: zsh-users 27258
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- Cc: Zach Riggle <zachriggle@xxxxxxxxx>, Lawrence Velázquez <larryv@xxxxxxx>, Zsh Users <zsh-users@xxxxxxx>
- Subject: Re: Odd behavior with various (q) array modifiers and non-printable characters (backspace, newline)
- Date: Thu, 21 Oct 2021 08:23:15 -0700
- Archived-at: <https://zsh.org/users/27258>
- In-reply-to: <20211021142408.GB16034@tarpaulin.shahaf.local2>
- List-id: <zsh-users.zsh.org>
- References: <CAMP9c5k=MRwfuR_xNzJjUAMO8ds7Kr=OpM2QMD9+A9hLKHu3iw@mail.gmail.com> <CAH+w=7bkaBZYR0Ok+zwqEqNDAjRDK1GyP9k74wY4-X+6jOrTEw@mail.gmail.com> <27bc215c-3916-4afe-b8b3-7946dd0cb4bc@www.fastmail.com> <20210814155252.GG11391@tarpaulin.shahaf.local2> <CAMP9c5kLJnSzowD9hNo2LQOnVKqDhQ1=3Zy=wfYeb5iEAn+5yw@mail.gmail.com> <20211021142408.GB16034@tarpaulin.shahaf.local2>
On Thu, Oct 21, 2021 at 7:24 AM Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx> wrote:
>
> Zach Riggle wrote on Tue, Oct 19, 2021 at 14:17:48 -0500:
> > print-a-$-and-then-the-minally-quoted-version-of-this-array-of-scalars when
> > dealing with regex, due to "builtin echo" treating '\bfoo bar\b'
> > incorrectly.
>
> Why, does it output «\b» literally (two printable characters)? It
> should emit backspaces (ASCII 0x08).
He's trying to use \b as a word boundary marker in a regular
expression so he wants literal \b rather than backspace.
% builtin echo '\bfoo bar\b' | od -ac
0000000 bs f o o sp b a r bs nl
\b f o o b a r \b \n
0000012
% command echo '\bfoo bar\b' | od -ac
0000000 \ b f o o sp b a r \ b nl
\ b f o o b a r \ b \n
0000014
(apologies if you're looking at this in a proportional font)
Messages sorted by:
Reverse Date,
Date,
Thread,
Author