Originally Posted by meninvenus
Problem 1# Every system requires a password to login into it, so how to pass password in the script?
Use Expect, a tcl programming language designed to write programs to run non-interactively which usually require input. Or *much
* better, set up SSH public/private keys and do password-less authentication. Look into the ssh-keygen and ssh-copy-id commands to help you w/this. They are part of the OpenSSH suite and are likely already on your system.
Problem 2# How to save the output of command between do and done in the system from where I am running it (else it will save the output file in different systems)?
The way you've written it, it should NOT write it to the remote system, but to the local one. To force it to write it remotely, you'd normally do something like:
ssh user@sytem "date >/tmp/remote.txt"
Have you verified that it isn't writing locally or is that just a theory?