Эх сурвалжийг харах

Fix set up script not replacing dead symlinks

The backup function's `-e` does not catch symlinks to non-existent files, and we
do not need to back those up anyway. Instead, we force the link after backup of
any real files happens.
Weiyi Lou 10 жил өмнө
parent
commit
38445e267d
1 өөрчлөгдсөн 2 нэмэгдсэн , 2 устгасан
  1. 2 2
      setup.sh

+ 2 - 2
setup.sh

@@ -19,13 +19,13 @@ mkdir "$backup_dir"
 
 # Backup a given file.
 backup() {
-  [ -e "$1" ] && mv "$1" "$backup_dir"
+  [[ -e "$1" ]] && mv "$1" "$backup_dir"
 }
 
 # Create links after backing up.
 linkup() {
   backup "$2"
-  ln -s "$1" "$2"
+  ln -sf "$1" "$2"
 }
 
 # Run vim-plug's install process.