I want to run the same set of Unix commands on multiple machines. I am aware of ssh and something like the below. I want to write a shell script to do this. I have access to bash and ksh and I'm on Linux Red Hat 5.
ssh root@ip "echo \$HOME"
You should use key based authentification, possibly coupled with
ssh-agent to remember key passphrase.
You can invoke
sh -c as the command, and pass it a string containing the list of command to execute.
ssh invoke a shell on the remote machine, so you can pass a list of command as a string.
$ ssh user@ip "echo 'Hello world'; whoami; cd / ; ls"