Bash File Backup via SSH
I am trying to make a bash script that will transfer a file from my machine to a server maintained by my school that is used to back up code. It is a hassle to transfer the file manually every single time that I want to make the transfer.
Some applications, like TextWrangler, have the ability to save to server. However, I would rather be able to do it quickly from terminal.
Where would I go from here? Would I need to somehow pass in the file I'd like to send as a parameter? Is there a way to make sure that it goes to the correct directory?
#!/bin/bash # This should log me into orca # http://aruljohn.com/info/filetransfer/ # http://stackoverflow.com/questions/1895185/how-to-ssh-from-within-a-bash-script sftp username@place expect "username@place password: " sleep 1 send "mypassword"
Why not use "scp" secure copy instead of sftp.
You don't need "expect" to run this, and, if you configure the remote/local certificates properly you will not need to mess with passwords.