shell script for how to connect to a remote server by using ssh

i want to connect to a remote server through ssh.
i have to also provide password within that script.
after connecting to the remote server i want to do some operations like grep,cd etc

can u pls help me to wite a script.
Thanks

To get around entering the password for the SSH connection look into setting up SSH public key authentication. With that set up you can start remote commands with "ssh [user@]host '<command>'"

As an alternative, check out expect, although saving passwords in a plain-text file is absolutely not advised