【发布时间】:2017-08-31 17:58:55
【问题描述】:
我正在尝试编写一个 rsync 脚本,它将用户输入的路径带到源文件并将其发送到远程计算机上的另一个用户输入的路径。
#!/bin/bash
echo -e "What is the directory on the local machine you want to send"
read sourcedir
SOURCEDIR = :$sourcedir
echo -e "What is the directory on the GPU box you want to send these files over to?"
read destdir
DESTDIR = :$destdir
rsync -avu -e "ssh -p xxxx" $SOURCEDIR $DESTDIR user@remote.computer --progress
当我执行脚本时,我得到以下错误
-bash: DESTDIR: command not found
building file list ...
rsync: link_stat "/path/to/script/user@remote.computer" failed: No such file or directory (2)
0 files to consider
sent 29 bytes received 20 bytes 98.00 bytes/sec
total size is 0 speedup is 0.00
rsync error: some files could not be transferred (code 23) at /BuildRoot/Library/Caches/com.apple.xbs/Sources/rsync/rsync-51/rsync/main.c(996) [sender=2.6.9]
非常感谢您对正确编写此脚本的建议/建议。
PS。我已经从输出中删除了一些敏感信息,但请放心,格式与计算机输出的一致。
【问题讨论】: