How to display newline in ssh

How to display newline in ssh

I’m trying to do the following:

#!/bin/sh
ssh [email protected] "echo "Test n for newline""

This displays:

test n for newline

How do I get the shell to interpret n as an actual newline?

Try using the -e option, e.g., echo -e "Test n for newline".

If your echo doesn’t have a -e option, then I’d use printf. It’s widely available and it does not have nearly as many variations in it’s implementations.

.
.
.
.