I'm trying to execute commands on a remote machine via ssh, and I need the script to wait until the ssh password is provided (if necessary). This my code snippet:
ssh -T ${remote} << EOF
if [ ! -d $HOME/.ssh ]; then
mkdir $HOME/.ssh
touch $HOME/.ssh/authorized_keys
chmod 0600 $HOME/.ssh/authorized_keys
fi;
EOF
The problem is, commands between EOFs start executing on the local machine without waiting for the pass to be provided. Is there any way to wait for the pass before continuing with the script?