Hi Oliver,
Thanks for the explanation. I had no idea the echo behaviour depended on BSD (BSD-like) vs SysV, so that explains why I was seeing different results. The tip about printf for portability is also super helpful.
Really appreciate you taking the time.
Jelius
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