dotfiles/create.sh
2019-01-22 09:40:04 +01:00

39 lines
718 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
create_ling .ackrc
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 named directory-tree if not existent
mkdir -p $HOME/.vim/swap
create_link .vimrc