Make scp prompt me for a username and password

scp

I'm calling scp from a script and want it to prompt the user running the script for their password. How do I do that?

Best Answer

Write the prompt first, read the variable, then use the variable to connect with scp

echo -n "username:"
read USERNM

scp $USERNM@whatever