readme verifie et install un sym link pour vimrc screenrc et zshrc

This commit is contained in:
hugodu69
2019-02-06 03:39:25 +01:00
parent 0add5ade1e
commit 2d53cd8270
4 changed files with 151 additions and 15 deletions

View File

@@ -1,17 +1,66 @@
#
# put this folder "config" into the $HOME directory
# and execute the following commands or
# just run this README.txt file as an
# executable with sh README.txt
# and run sh README.txt
#
# it will check if .vimrc, .screenrc and .zshrc already
# exists in the $HOME directory and if not it will create
# a sym link in $HOME to those in this config folder
# otherwise if it exist it will add the content of those
# in this config folder to the one already there in $HOME
#
ln -s $HOME/config/.screenrc $HOME/.screenrc
ln -s $HOME/config/.vimrc $HOME/.vimrc
SCREEN="$HOME/.screenrc"
MYSCREEN="$HOME/config/.screenrc"
VIM="$HOME/.vimrc"
MYVIM="$HOME/config/.vimrc"
ZSH="$HOME/.zshrc"
MYZSH="$HOME/config/.zshrc"
# it will create a symbolic lynk to the
# .vimrc and .screenrc files
# located in the config folder
# of course if there already are .vimrc
# and .screenrc files in home directory
# it will not work, so you need to check
# manually what you need to transfer from
# these files to the already existing ones
# -------------------------------------------------------------
# action on the .screenrc file
# -------------------------------------------------------------
if [ -f $SCREEN ];
then
if grep -q '#hugogogo#' $SCREEN;
then
sed '/#hugogogo#/,/#hugogogo#/d' $SCREEN > $SCREEN.tmp && mv $SCREEN.tmp $SCREEN
fi
cat $MYSCREEN >> $SCREEN
else
ln -s $MYSCREEN $SCREEN
fi
# -------------------------------------------------------------
# action on the .vimrc file
# -------------------------------------------------------------
if [ -f $VIM ];
then
if grep -q '"hugogogo"' $VIM;
then
sed '/"hugogogo"/,/"hugogogo"/d' $VIM > $VIM.tmp && mv $VIM.tmp $VIM
fi
cat $MYVIM >> $VIM
else
ln -s $MYVIM $VIM
fi
# -------------------------------------------------------------
# action on the .zshrc file
# -------------------------------------------------------------
if [ -f $ZSH ];
then
if grep -q '#hugogogo#' $ZSH;
then
sed '/#hugogogo#/,/#hugogogo#/d' $ZSH > $ZSH.tmp && mv $ZSH.tmp $ZSH
fi
cat $MYZSH >> $ZSH
else
ln -s $MYZSH $ZSH
fi