From f1b07329ef904a360353a68b692d11b1fe78a148 Mon Sep 17 00:00:00 2001 From: "R. Steve McKown" Date: Tue, 2 Jun 2015 17:16:45 -0600 Subject: [PATCH] Add install script (sets symlinks) --- install.sh | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100755 install.sh diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..252e37c --- /dev/null +++ b/install.sh @@ -0,0 +1,27 @@ +#!/bin/bash +# Install symlinks to dotfiles + +dolink() +{ + src="$1" + target="$2" + + if [ -L "$target" ]; then + # Target is a symlink. Remove and recreate it just to be sure + echo "Relinking $src -> $target" + rm "$target" + ln -s "$src" "$target" + elif [ -e "$target" ]; then + # Target exists and is not a symlink. Report and do not relink. + echo "ERROR: target $target exists and is not a symlink" >&2 + else + # Target does not exist. Create it. + ln -s "$src" "$target" + echo "Symlinking $src -> $target" + fi +} + +cd ~ + +dolink .dotfiles/vim .vim +dolink .dotfiles/vimrc .vimrc -- 2.39.2