minor update to dotfiles-install.sh

This commit is contained in:
PowerUser64 2022-04-08 13:49:06 -07:00
parent f5e15cacde
commit 244939b28c

View file

@ -2,7 +2,7 @@
# this script will install the dotfiles from the target git repository, and back up any conflicting files
# credit for this idea and basic script outline goes to https://www.atlassian.com/git/tutorials/dotfiles
# TODO: make it so like 31 (DOTFILES_BACKUP_LIST) can handle spaces
# TODO: make it so line 31 (DOTFILES_BACKUP_LIST) can handle spaces (do it in a for loop)
DOTFILES_REPO_DIR="$HOME/git/dotfiles"
DOTFILES_REPO_URL="https://git.blakenorth.net/dotfiles"
@ -31,7 +31,7 @@ else
DOTFILES_BACKUP_LIST=($(dot checkout 2>&1 | grep -Po "(?<=\t)(.*)$"))
# create directories for everything that needs one
mkdir -p "$DOTFILES_BACKUP_DIR" $(printf '%s\n' "${DOTFILES_BACKUP_LIST[@]}" | grep -Po '.*/' | sed "s#.*#$DOTFILES_BACKUP_DIR/&#g")
# backup the files to avoid them being overwritten
# backup existing files to avoid them being overwritten
printf '%s\n' "${DOTFILES_BACKUP_LIST[@]}" | xargs -I{} mv "$HOME"/{} "$DOTFILES_BACKUP_DIR"/{}
fi