improved regex with a look-behind zero-width assertion
This commit is contained in:
parent
76d032fd3a
commit
1f57a0d47b
1 changed files with 1 additions and 1 deletions
|
@ -26,7 +26,7 @@ if dot checkout > /dev/null 2>&1; then
|
|||
else
|
||||
echo "Backing up pre-existing dotfiles."
|
||||
# get the list of files that need to be backed up
|
||||
DOTFILES_BACKUP_LIST=($(dot checkout 2>&1 | grep -Po "\t.*$" | cut -c 1 --complement))
|
||||
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
|
||||
|
|
Loading…
Add table
Reference in a new issue