I am trying to make a script that will sync with another folder over a ssh connection. What I want to do is sync my local folder with the folder over ssh and then perform an ssh login. For these two commands I need to enter the same password and it's a little annoying so I am trying to make a script for it to put my password into a temporary variable and pass that variable to the two spots it is requested. This is what I have.
read -s -p "Enter Password: " mypassword && echo "$mypassword"
| rsync -vz -r `~/Desktop/Market_Maker/Market_Maker [email protected]:~/281_Projects
&& echo | "$mypassword" ssh [email protected]`
What this ends up doing is gives me 3 password prompts and does not work at all. What is wrong with the script?
echoto pass passwords into a prompt.