Reputation: 563
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
Upvotes: 2
Views: 10737
Reputation: 189437
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.
Upvotes: 4