Echo newline in Bash prints literal \n
Make sure you are in Bash.
$ echo $0
bash
All these four ways work for me:
echo -e "Hello\nworld"
echo -e 'Hello\nworld'
echo Hello$'\n'world
echo Hello ; echo world
Use printf
instead:
printf "hello\nworld\n"
printf
behaves more consistently across different environments than echo
.