【发布时间】:2011-12-02 03:52:13
【问题描述】:
我正在尝试制作一个 bash 脚本,它将文件从我的机器传输到我学校维护的用于备份代码的服务器。每次我要进行传输时都手动传输文件很麻烦。
某些应用程序,例如 TextWrangler,可以保存到服务器。但是,我宁愿能够从终端快速完成。
我会从这里去哪里?我是否需要以某种方式传入我想作为参数发送的文件?有没有办法确保它进入正确的目录?
#!/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"
【问题讨论】:
-
也许这个问题会在 serverfault 或 ubuntu 上得到更好的答案。