diff options
author | Xuehai Pan <XuehaiPan@pku.edu.cn> | 2021-09-10 04:18:09 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-09 22:18:09 +0200 |
commit | 358ac6a141010b19175d0eb5a6f28ff544aa75d3 (patch) | |
tree | f0742162fdfaf698b2092c596a900ec77d1d1905 /plugins/cp | |
parent | aa6e932b06137a697296ea5be62c73905ff68848 (diff) | |
download | zsh-358ac6a141010b19175d0eb5a6f28ff544aa75d3.tar.gz zsh-358ac6a141010b19175d0eb5a6f28ff544aa75d3.tar.bz2 zsh-358ac6a141010b19175d0eb5a6f28ff544aa75d3.zip |
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`
Diffstat (limited to 'plugins/cp')
-rw-r--r-- | plugins/cp/README.md | 2 | ||||
-rw-r--r-- | plugins/cp/cp.plugin.zsh | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/plugins/cp/README.md b/plugins/cp/README.md index e8a9b6ccc..23734243c 100644 --- a/plugins/cp/README.md +++ b/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). -* `--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). diff --git a/plugins/cp/cp.plugin.zsh b/plugins/cp/cp.plugin.zsh index fe6ea87a8..a56259106 100644 --- a/plugins/cp/cp.plugin.zsh +++ b/plugins/cp/cp.plugin.zsh @@ -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 |