I'm trying to do the following:
#!/bin/sh
ssh user@server "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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With