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)



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