I essentially want to run a script on machine A which will SSH into machine B, execute commands on B, and return the output to machine A.
So I am creating a csh script to do this, hopefully, if it's possible.
For instance, this solution from this answer works from command line:
ssh user@host << 'ENDSSH'
ls -l
ENDSSH
I can verify it is running the ls on the remote and not locally.
However I want to be able to do this within the backticks, inside my csh script running locally. Would that be possible?
What I have tried is this, and it doesn't work.
`ssh user@host<<'ENDSSH'`
`echo "ls -l"`
`echo "ENDSSH"`
I know it is possible to SSH in and run a script that is on the remote, but that is not my case.
I have also heard it is possible to send a second script stored locally over the SSH (which I also have not figured out), but I like the idea of having all of the commands inside the original script, hence the HEREDOC.
I know it is a pretty particular question, but if there is a way, it would be very cool to know how.
Aucun commentaire:
Enregistrer un commentaire