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 27257
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: Zach Riggle <zachriggle@xxxxxxxxx>
- Cc: 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 14:24:08 +0000
- Archived-at: <https://zsh.org/users/27257>
- In-reply-to: <CAMP9c5kLJnSzowD9hNo2LQOnVKqDhQ1=3Zy=wfYeb5iEAn+5yw@mail.gmail.com>
- 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>
Zach Riggle wrote on Tue, Oct 19, 2021 at 14:17:48 -0500:
> Apologies for resurrecting this thread, but I wanted to revisit and thank
> everybody for the help.
>
> I ran into some issues where my
> 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).
> I attempted a variety of things to fix the problem, but going back through
> this thread really helped a bunch. I had written additional code that
> relied in builtin echo. "command echo" and the issue is resolved.
>
echo(1)'s semantics aren't portable. Use printf(1) for portable sh code
or the builtin «print» for portable zsh code.
Daniel
Messages sorted by:
Reverse Date,
Date,
Thread,
Author