mirror of
https://github.com/robbyrussell/oh-my-zsh.git
synced 2026-09-26 04:56:05 +02:00
refactor(installer): reuse timestamp for backup naming loop
Co-authored-by: robbyrussell <257+robbyrussell@users.noreply.github.com>
This commit is contained in:
co-authored by
robbyrussell
parent
bc6faea85b
commit
ed01423b18
+2
-1
@@ -417,10 +417,11 @@ setup_zshrc() {
|
||||
hist_backup_base="${hist}.pre-oh-my-zsh"
|
||||
hist_backup="$hist_backup_base"
|
||||
if [ -e "$hist_backup" ]; then
|
||||
hist_backup_ts="$(date +%Y-%m-%d_%H-%M-%S)"
|
||||
hist_backup_i=0
|
||||
while [ -e "$hist_backup" ]; do
|
||||
hist_backup_i=$((hist_backup_i + 1))
|
||||
hist_backup="${hist_backup_base}-$(date +%Y-%m-%d_%H-%M-%S)-${hist_backup_i}"
|
||||
hist_backup="${hist_backup_base}-${hist_backup_ts}-${hist_backup_i}"
|
||||
done
|
||||
fi
|
||||
if cp -p "$hist" "$hist_backup"; then
|
||||
|
||||
Reference in New Issue
Block a user