You're going about it the wrong way. What you want to do is generate a passwordless ssh-key pair and then (as long as the server supports RSA key authentication,) you can get in without having to type a password for all. This is a security risk if your private key is stored somewhere that it could be stolen.
Follow these steps:
- mkdir -p ~/.ssh
- cd ~/.ssh
- ssh-keygen -type dsa -i mysshkeys
- Press Return when prompted for passphrase
- Press Return a second time to confirm.
 There will now be two files in your ~/.ssh directory, mysshkey.pub and mysshkey. mysshkey.pub is your public key, this one is safe to put on remote servers. mysshkey is your private passwordless key, it is not safe to put on remote servers (or somewhere someone else could get a copy).
On the server you wish to SSH tointo:
- Login to the remote server
- mkdir -p ~/.ssh
-  CutCopy and paste the contents of mysshkey.pubinto~/.ssh/authorized_keys
-  Make sure that ~/.ssh/authorized_keysischmod'd to600
Now, to put it into action on your local machine you run the following command:
ssh -i ~/.ssh/mysshkey <remote_server_ip>
And you will be logged in without being prompted for a password.
This is a much preferable method of managing automated logins as you don't end up hard-coding your password multiple places that need to be updated if you ever change it.
 
                 
                 
                