0

I'm trying to write a bash script to automatically do stuff in clients machines in the network. But after the code

ssh -i ~/.ssh/key root@machine

The bash program just stops What can I do to send the command to the remote machine? Thanks

2
  • What do you mean it 'just stops'? Commented Nov 30, 2012 at 16:41
  • It means the bash stops and the screens shows the connexion with the client's machine, waiting for my command. The programs continues when I type "exit" Commented Dec 1, 2012 at 21:37

1 Answer 1

3

Same way as if you were invoking bash directly.

ssh ... somescriptontheserver.sh

ssh ... ls -lR /

ssh ... << EOF
ls -lR /
EOF
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.