浏览代码

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`
Xuehai Pan 3 年之前
父节点
当前提交
358ac6a141
共有 2 个文件被更改,包括 2 次插入2 次删除
  1. 1 1
      plugins/cp/README.md
  2. 1 1
      plugins/cp/cp.plugin.zsh

+ 1 - 1
plugins/cp/README.md

@@ -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).
 * `-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).
 * `-e /dev/null`: only work on local files (disable remote shells).
 
 

+ 1 - 1
plugins/cp/cp.plugin.zsh

@@ -1,4 +1,4 @@
 cpv() {
 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
 compdef _files cpv