Files
huhuhu_config/README.txt
2020-12-01 14:01:02 +01:00

81 lines
1.9 KiB
Plaintext

#
# put this folder "config" into the $HOME directory
# 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
#
SCREEN="$HOME/.screenrc"
MYSCREEN="$HOME/config/.screenrc"
VIM="$HOME/.vimrc"
MYVIM="$HOME/config/.vimrc"
# create the ~/.vim/swapfiles folder if necessary :
mkdir -p ~/.vim/swapfiles
ZSH="$HOME/.zshrc"
MYZSH="$HOME/config/.zshrc"
# -------------------------------------------------------------
# action on the .screenrc file
# -------------------------------------------------------------
if [ -f $SCREEN ]; then
if [ ! -L $SCREEN ]; then
if grep -q '#hugogogo#' $SCREEN;
then
sed '/#hugogogo#/,/#hugogogo#/d' $SCREEN > $SCREEN.tmp
mv $SCREEN.tmp $SCREEN
fi
cat $MYSCREEN >> $SCREEN
fi
else
ln -s $MYSCREEN $SCREEN
fi
# -------------------------------------------------------------
# action on the .vimrc file
# -------------------------------------------------------------
if [ -f $VIM ]; then
if [ ! -L $VIM ]; then
if grep -q '"hugogogo"' $VIM;
then
sed '/"hugogogo"/,/"hugogogo"/d' $VIM > $VIM.tmp
mv $VIM.tmp $VIM
fi
cat $MYVIM >> $VIM
fi
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
echo "you don't have a .zshrc file in your \$HOME directory"
echo "maybe you should verify if you have zsh :"
echo "run 'zsh --version'"
echo "and if not, install it, otherwise create a .zshrc file"
echo "now run the script README.txt again"
echo "to set the dynamic title on screen"
fi