Added directory compatibility
Remove self-explanatory message to abort script and added compatibility with directories
This commit is contained in:
parent
26a0ec9cd7
commit
284d0988e0
@ -18,16 +18,16 @@ for FILE in $DOTFILES ; do
|
|||||||
if [ -L ~/$BASEFILE ]; then
|
if [ -L ~/$BASEFILE ]; then
|
||||||
# If basefile is not a file, and therefore is a broken symlink
|
# If basefile is not a file, and therefore is a broken symlink
|
||||||
if [ ! -f ~/$BASEFILE ]; then
|
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
|
rm ~/$BASEFILE
|
||||||
NEWLINK=1
|
NEWLINK=1
|
||||||
else
|
else
|
||||||
echo "~/$BASEFILE is already linked."
|
echo "~/$BASEFILE is already linked."
|
||||||
fi
|
fi
|
||||||
# If basefile is a regular file
|
# If basefile is a regular file or directory
|
||||||
elif [ -f ~/$BASEFILE ]; then
|
elif [ -f ~/$BASEFILE ] || [ -d ~/$BASEFILE ]; then
|
||||||
DATE=$(date '+%Y%m%d%H%M%S')
|
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
|
mv ~/$BASEFILE ~/$BASEFILE-$DATE
|
||||||
NEWLINK=1
|
NEWLINK=1
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user