I stumbled upon a weird problem with echo on GNU bash, version 5.1.12(1)-release (x86_64-pc-solaris2.11):
bash-5.1$ builtin echo -e 'a\tb'
a b
bash-5.1$ builtin echo 'a\tb'
a b
bash-5.1$ builtin echo +e 'a\tb'
+e a b
While it won’t affect my scripts because I tend to use printf, how do you turn echo -e off?
not a dup (I think): The question isn’t about the behaviour of echo in an arbitrary shell but in bash specifically.
>Solution :
You have the xpg_echo shell option enabled.
List the options by running shopt
Disable it with shopt -u xpg_echo
To figure this out, read the echo section of man builtins (assuming that gives you the bash builtin commands, otherwise look at https://www.gnu.org/software/bash/manual/html_node/Bash-Builtins.html)
The relevant part is
The xpg_echo shell option may be used to dynamically determine whether
or not echo expands these escape characters by default.