I\'m using key authentication, so password is not an issue. I have a file whose name I know and I simply want to send it to another machine over sftp.
I tried searching
I don't know how sftp was configurable when this question was asked. Anyway, 6 years later, you can put sftp-commands like PUT into a file and then reference this file in your initial sftp-call. The makes the whole process completely non-interactive and easily configurable:
sftp -i /path/to/ssh-key -b /path/to/sftp-commands.txt root@remote:/root/dropoff
....Where sftp-commands.txt just contains
put test.txt; quit