From d9286ac2bb864f8456592f7530318f95a619d677 Mon Sep 17 00:00:00 2001 From: Curtis McEnroe Date: Wed, 28 Mar 2018 13:36:01 -0400 Subject: 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. --- link.zsh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'link.zsh') 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 -- cgit 1.4.1