Reputation: 21
I'm trying to write several commands trought ssh connection bue I got problem with escape characters. Below an example of what I'd like to do:
/usr/bin/ssh mrtg@172.20.29.40 echo -e "ciao\nprova"
I got this result:
ciaonprova
instead of:
ciao
prova
if I use -e
option for ssh:
/usr/bin/ssh -e mrtg@172.20.29.40 echo -e 'ciao\nprova'
I receive this error:
Bad escape character 'mrtg@172.20.29.40'.
Can someone give me a suggestion to let remote server interpret escape characters?
Upvotes: 2
Views: 14899
Reputation: 14940
The -e
option has nothing to do with your command (these are SSH escape characters, not shell).
You can just put your command in quotes:
/usr/bin/ssh mrtg@172.20.29.40 'echo -e "ciao\nprova"'
Upvotes: 2