]> git.friedersdorff.com Git - max/dotfiles.git/blob - makelinks.sh
c63edcd3bba3f13677b24691eb9e775406663df0
[max/dotfiles.git] / makelinks.sh
1 #!/bin/bash
2 ############################
3 # .make.sh
4 # Create symlinks from the home directory to dotfiles in ~/etc/dotfiles
5 ############################
6
7 ########## Variables
8
9 dir=~/etc/dotfiles                    
10 olddir=~/etc/dotfiles.bak             
11 files="vimrc bashrc xsession"
12
13 ##########
14
15 # create dotfiles_old in homedir
16 echo -n "Creating $olddir for backup of any existing dotfiles in ~ ..."
17 mkdir -p $olddir
18 echo "done"
19
20 # change to the dotfiles directory
21 echo -n "Changing to the $dir directory ..."
22 cd $dir
23 echo "done"
24
25 # move any existing dotfiles in homedir to dotfiles_old directory, 
26 #then create symlinks from the homedir to any files in the 
27 #~/dotfiles directory specified in $files
28 for file in $files; do
29     echo "Moving any existing dotfiles from ~ to $olddir"
30     mv ~/.$file $olddir/
31     echo "Creating symlink to $file in home directory."
32     ln -s $dir/$file ~/.$file
33 done