dotfiles/create.sh
2018-07-12 08:23:50 +02:00

35 lines
627 B
Bash
Executable File

#!/bin/sh
# if the dotfile already exist and it is NOT a symbolic link,
# make a rename to save it and replace with an symbolic link to
# $HOME/dotfiles/$FILE
create_link () {
if [ -e $HOME/$1 ]
then
if [ ! -h $HOME/$1 ]
then
mv $HOME/$1 $HOME/$1.orig
ln -s $HOME/dotfiles/$1 $HOME/$1
fi
else
ln -s $HOME/dotfiles/$1 $HOME/$1
fi
}
create_link .bash_aliases
create_link .bash_profile
create_link .bashrc
create_link .bashrc_local
create_link .tmux.conf
if [ -d $HOME/.vim ]
then
if [ ! -h $HOME/.vim ]
then
mv $HOME/.vim $HOME/.vim.orig
ln -s $HOME/dotfiles/.vim $HOME/.vim
fi
fi
create_link .vimrc