PDA

View Full Version : echo - backslash interpretation



jamarir
2021-11-20, 10:41
When looking at echo's manual page, I see -E is used by default:
-n do not output the trailing newline
-e enable interpretation of backslash escapes[/HTML]
-E disable interpretation of backslash escapes (default)

But why -E needs to be added anyway to disable this interpretation ?



$ echo "Hello \t \World"
Hello \World

$ echo -E "Hello \t \World"
Hello \t \World


Shouldn't it be used by default ?

Fred Sheehan
2023-01-13, 23:12
It is used by default, but lets say you decide to change it to enabled -e, it then stays that way (not set at default) until you actually change it back, so yes, -E is also 'needed'....