I want to input the password to sftp using heredoc:
sftp root@example.com <<EOF
password
EOF
But it does not work. sftp still asks me to type password. I know I can use sshpass to input the password, but why cannot I just use the heredoc to input the password. I think heredoc will be read as the standard input for sftp. Am I misunderstanding something?