Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Bug Report: Escaped backslash incorrectly reinterpreted as control escape in double-quoted strings



Jelius Basumatary wrote:
> Example: “\\t…” instead of printing “\t…” it would print “       ….” even if
> the backslash was escaped, also bash prints it correctly as “\t…” .

Actually, bash behaves differently depending on whether it is running on
a BSD or SysV derived Unix. So on Solaris, you get a tab character while
on FreeBSD, it prints \t
ksh (at least the real AT&T one) does likewise.

Linux is of course not derived from either BSD or System V. It does
new file group ownership the SysV way, ps is a hybrid (but I think
it was BSD style early on) and Linux echo is BSD-like. Note also
that the zsh option to change this behaviour is named BSDECHO.

If you want reliable and portable printing in a shell script, use
printf.

Oliver




Messages sorted by: Reverse Date, Date, Thread, Author