-
Notifications
You must be signed in to change notification settings - Fork 0
/
symlinks.sh
29 lines (24 loc) · 1.05 KB
/
symlinks.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/bash
#
# Yaris Alex Gutierrez <yarisgutierrez@gmail.com>
# This script creates symbolic links from the home (~) directory to desired dotfiles in ~/git/dotfiles
#
### Vars ###
directory=~/git/dotfiles # dotfiles directory
old_directory=~/dotfiles_old # Old dotfiles backup directory
files="bashrc vimrc tmux.conf" # List of files/folders to symlink to the home dir
### Create dotfiles_old in the home directory ###
echo "Creating $old_directory for backup of any existing dotfiles in the current home directory..."
mkdir -p $old_directory
echo "...done"
### Change to the dotfiles directory ###
echo "Changing to the $directory directory..."
cd $directory
echo "...done"
### Move any existing dotfiles in the home directory to dotfiles_old, then create the symbolic links
for file in $files; do
echo "Moving any existing dotfiles from the current home directory to $old_directory..."
mv ~/.$file ~/dotfiles_old
echo "Creating symbolic links to $file in home directory..."
ln -s $directory/$file ~/.$file
done