Files
huhuhu_config/old.bak

83 lines
1.9 KiB
Plaintext

#
# put this folder "huhuhu_config" into the $HOME directory
# and run sh README.txt
#
# it will check if .vimrc, .screenrc and .zshrc already
# exists in the $HOME directory :
# - if it already exist, it will copy the existing file or
# folder into <file>.bak[0.9]
# - then it will create a sym link in $HOME to those in
# this config folder
#
SCREEN="$HOME/.screenrc"
MYSCREEN="$HOME/huhuhhu_config/.screenrc"
VIM="$HOME/.vimrc"
MYVIM="$HOME/huhuhu_config/.vimrc"
# create the ~/.vim/swapfiles folder if necessary :
mkdir -p ~/.vim/swapfiles
ZSH="$HOME/.zshrc"
MYZSH="$HOME/huhuhu_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
fi
ln -s $MYSCREEN $SCREEN
# -------------------------------------------------------------
# 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