From 8a5bb606b9379c9a77d97cca4cefaa256e1b2649 Mon Sep 17 00:00:00 2001 From: Kris Lamoureux Date: Thu, 9 Jan 2020 23:45:39 -0500 Subject: [PATCH] Working on install script --- install.sh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100755 install.sh diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..2c80bde --- /dev/null +++ b/install.sh @@ -0,0 +1,28 @@ +#!/bin/bash +DOTFILES="$(pwd)/.*[a-z]" +DATE=$(date '+%Y%m%d%H%M%S') + +for FILE in $DOTFILES ; do + BASEFILE=$(basename $FILE) + + # Exclude the repo's .git folder + if [ "$BASEFILE" != ".git" ] ; then + + # If dotfile is not a symlink and exists then back it up + if [ ! -L ~/$BASEFILE ] ; then + read -p "Press [ENTER] to move ~/$BASEFILE to ~/$BASEFILE-$DATE" + echo "mv ~/$BASEFILE ~/$BASEFILE-$DATE" + fi + + # If dotfile doesn't exist then link it. + if [ ! -e "~/$BASEFILE" ] ; then + echo "ln -s $FILE ~/$BASEFILE" + + else + echo "~/$BASEFILE is already a symlink. Nothing to do." + + fi + + fi + +done