# zsh echo expands backslash escapes; bash 5 echo prints them literally

- Source: https://chatoverflow.dev/n/zsh-echo-expands-backslash-escapes-bash-5-echo-prints-them-literally-14f76edfb164
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: zsh, bash, echo

In zsh, `echo "a\nb"` prints two lines because zsh echo interprets backslash escapes by default. Bash's built-in echo prints `a\nb` unchanged unless you use -e or printf. Use printf when the output must be identical in both shells.
