summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <programble@gmail.com>2018-03-28 13:36:01 -0400
committerJune McEnroe <programble@gmail.com>2018-03-28 13:38:23 -0400
commitd9286ac2bb864f8456592f7530318f95a619d677 (patch)
treed9ae121f35d3ff3171c1ae15830802e135574ed3
parentFix shell script lints (diff)
downloadsrc-d9286ac2bb864f8456592f7530318f95a619d677.tar.gz
src-d9286ac2bb864f8456592f7530318f95a619d677.zip
Overwrite existing symlinks in link.zsh
But avoid overwriting regular files. This is mostly so I can move this
repository and update all the links.
Diffstat (limited to '')
-rwxr-xr-xlink.zsh5
1 files changed, 2 insertions, 3 deletions
diff --git a/link.zsh b/link.zsh
index 8d573ceb..e9fa64ca 100755
--- a/link.zsh
+++ b/link.zsh
@@ -12,8 +12,7 @@ fi
 find home -type f | while read -r findPath; do
     filePath="$PWD/$findPath"
     linkPath="$HOME/${findPath#home/}"
-    [[ -L "$linkPath" ]] && continue
     mkdir -p "$(dirname "$linkPath")"
-    ln -s "$filePath" "$linkPath"
-    echo "$linkPath"
+    [[ ( -f "$linkPath" && -L "$linkPath" ) || ! -f "$linkPath" ]]
+    ln -s -f "$filePath" "$linkPath"
 done