SSH remote server - display only "echo" on output in terminal
10,014
Specifying the commands on standard input with ssh -t
causes the commands to be echoed back, but you don't have to do that.
ssh -t [email protected] "
cd /home/admin
mkdir test
echo 'Some text'"
(The exit
isn't really required or useful, so I left it out.)
Use single quotes if you want to prevent the local shell from interpolating variables etc in the string containing the commands.
To selectively display an individual command as well as its output, you can use something like
sh -vc 'echo \"Some text\"'
although the nested quoting can start getting on your nerves pretty quickly.
Author by
kevas
Updated on June 05, 2022Comments
-
kevas almost 2 years
I have bash script (for example):
ssh -t -t [email protected] << EOF cd /home/admin mkdir test echo 'Some text' exit EOF
Can I display only "echo" command in terminal? It is possible?
Now all commands are displayed.
Thank you