Added directory compatibility

Remove self-explanatory message to abort script and added
compatibility with directories
This commit is contained in:
Kris Lamoureux 2020-01-12 23:52:35 -05:00
parent 26a0ec9cd7
commit 284d0988e0
Signed by: kris
GPG Key ID: 3EDA9C3441EDA925

View File

@ -18,16 +18,16 @@ for FILE in $DOTFILES ; do
if [ -L ~/$BASEFILE ]; then
# If basefile is not a file, and therefore is a broken symlink
if [ ! -f ~/$BASEFILE ]; then
read -p "Press [ENTER] to replace broken symlink ~/$BASEFILE. CTRL+C aborts"
read -p "Press [ENTER] to replace broken symlink ~/$BASEFILE."
rm ~/$BASEFILE
NEWLINK=1
else
echo "~/$BASEFILE is already linked."
fi
# If basefile is a regular file
elif [ -f ~/$BASEFILE ]; then
# If basefile is a regular file or directory
elif [ -f ~/$BASEFILE ] || [ -d ~/$BASEFILE ]; then
DATE=$(date '+%Y%m%d%H%M%S')
read -p "Press [ENTER] to move ~/$BASEFILE to ~/$BASEFILE-$DATE. CTRL+C aborts"
read -p "Press [ENTER] to move ~/$BASEFILE to ~/$BASEFILE-$DATE."
mv ~/$BASEFILE ~/$BASEFILE-$DATE
NEWLINK=1
else