Part 1) I try to execute an echo hostname
on my remote host (using ssh).
just the hostname
command it works. But I have to echo the hostname because I have to copy it.
Part2) Paste the copied hostname (of the host) to a folder which is local. Can someone help me? I tried:
ssh -tt -i key.pem centos@ec2xxx .amazonaws.com sudo sh -c \ "echo `hostname`" >> /myfile
But this is just giving me an empty line. I have to use echo in it (assignement)