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)
On Wed, Aug 11, 2021, at 7:25 PM, Zach Riggle wrote:
> TLDR 1: I learned/realized that zsh builtin echo automatically
> interprets escape codes, unlike bash echo and /bin/echo.
But like the builtins of dash and yash.
% zsh -c 'echo "a\nb"'
a
b
% bash -c 'echo "a\nb"'
a\nb
% ksh -c 'echo "a\nb"'
a\nb
% dash -c 'echo "a\nb"'
a
b
% yash -c 'echo "a\nb"'
a
b
The echo(1) utility is notoriously unportable [1][2], and it's worth
considering avoiding it completely.
[1]: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/echo.html#tag_20_37_16
[2]: https://wiki.bash-hackers.org/commands/builtin/echo#portability_considerations
--
vq
Messages sorted by:
Reverse Date,
Date,
Thread,
Author