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