The correct answer for your question is sshpass (see other answer for details), there is a more secure way - SSH keys. You are just three easy steps away from ...
The correct way to do this, is to switch from password authentication to a public/private key pair. This typically needs no reconfiguration at all and is quite ...
To use password authentication instead of a key, SSH must allow passwords. Inside of /etc/ssh/sshd_config Change the PasswordAuthentication option from no to ...