From 6df78db098e23b3a7e2ccba954d24e2cf12db7c1 Mon Sep 17 00:00:00 2001 From: Ein Verne Date: Sun, 18 Oct 2015 15:46:49 +0800 Subject: [PATCH] check directory and file - check whether directory and file exist - delete cat _vimrc > .vimrc --- install.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/install.sh b/install.sh index 413691a..5339f76 100755 --- a/install.sh +++ b/install.sh @@ -6,10 +6,15 @@ echo "all your old vim settings will be mv to .vimrc.old & .vim.old" echo -en "Do you want to continue?[y/n]" read -n 1 use_vim_configs if [ "$use_vim_configs" == "Y" ] || [ "$use_vim_configs" == "y" ]; then - mv $VIMDIR/.vim $VIMDIR/.vim.old - mv $VIMDIR/.vimrc $VIMDIR/.vimrc.old + if [ -d "$VIMDIR/.vim" ]; then + mv $VIMDIR/.vim $VIMDIR/.vim.old + echo "origin .vim directory has been moved to .vim.old" + fi + if [ -f "$VIMDIR/.vimrc" ]; then + mv $VIMDIR/.vimrc $VIMDIR/.vimrc.old + echo "origin .vimrc has been moved to .vimrc.old" + fi ln -s $PWD/.vim $VIMDIR/.vim 2> /dev/null - cat $PWD/_vimrc > $PWD/.vimrc ln -s $PWD/.vimrc $VIMDIR/.vimrc 2> /dev/null fi