You might want to use passwords in scripts. as the interactive password entering is not possible in scripts, here is a work-around.
First install expect (assuming you are using Ubuntu or a similar distribution type the following:
sudo /apt-get install expect
after that the following can be used as a script – in the example below it is used to connect to a computer with ssh
#!/usr/bin/expect -f spawn ssh email@example.com expect "assword:" send "mypassword\r" interact
save the script (script.sh), close the script and make it executable by typing
chmod a+x script.sh
That’s all. Now you can execute your script by typing