I am using the following ssh command to access the remote server. when i do it manuaaly from "$" prompt it asks the password and when I give the right password this works:
ssh xyz@10.10.123.145
But, if i am doing it in a shell scripting, how to pass the password with in the script.
I tried the below which didn't work . Still it prompts me for the password
you're not going to get it to work that way; ssh is built for secure communication and simply passing your password into the process is not very secure.
You'll need to read up further on ssh, as it may vary according to your ssh client, ssh host and maybe even both.
$ man ssh
$ ssh --help
However, if you're scripting ssh you're probably looking for a non-interactive session which pretty much points you towards needing some credentials-based authentication, usually without a pass-phrase. Read up on your local ssh details from the commands above, then search this site for the way too many examples of how to do it right. [Some threads may refer to expect as an option...but this is not altogether clear-cut, nor is it on every machine...]
If you're still unable to move ahead, pop back onto this thread with your next questions. HTH