fix(cp): add unique suffix to rsync backup directory for each user (#10170)

* fix(cp): add unique suffix to rsync backup directory for each user

* fix(cp): use `USERNAME` rather than `USER`
This commit is contained in:
Xuehai Pan 2021-09-10 04:18:09 +08:00 committed by GitHub
parent aa6e932b06
commit 358ac6a141
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -25,7 +25,7 @@ The enabled options for rsync are:
* `-hhh`: outputs numbers in human-readable format, in units of 1024 (K, M, G, T).
* `--backup-dir=/tmp/rsync`: move backup copies to "/tmp/rsync".
* `--backup-dir="/tmp/rsync-$USERNAME"`: move backup copies to "/tmp/rsync-$USERNAME".
* `-e /dev/null`: only work on local files (disable remote shells).

View File

@ -1,4 +1,4 @@
cpv() {
rsync -pogbr -hhh --backup-dir=/tmp/rsync -e /dev/null --progress "$@"
rsync -pogbr -hhh --backup-dir="/tmp/rsync-${USERNAME}" -e /dev/null --progress "$@"
}
compdef _files cpv