diff --git a/.local/bin/dotfiles-install.sh b/.local/bin/dotfiles-install.sh index f548f75..0028d69 100755 --- a/.local/bin/dotfiles-install.sh +++ b/.local/bin/dotfiles-install.sh @@ -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