-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdotfile_setup
executable file
·44 lines (38 loc) · 1.35 KB
/
dotfile_setup
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
############################
# This script creates symlinks from the home directory to any desired dotfiles in ~/dotfiles
# Thanks to michaeljsmalley for the template
# https://github.com/michaeljsmalley/dotfiles/blob/master/makesymlinks.sh
############################
# TODO:
# fill out rest of what to do if file exists
# move other dotfiles over
# bashrc
# profile (fix to just use bashrc, probably)
# look for bashrc and profile, try to find a way to reconcile differences or use both?
dotfiles_dir=~/code/melchrc # dotfiles directory copied from github
# get list of dotfiles
cd $dotfiles_dir
echo "cd $dotfiles_dir"
shopt -s nullglob
# too difficult to blacklist which dot files to ignore, so whitelist instead
dotfiles=(.agignore .vimrc .slate .gitconfig .profile .bashrc .bash_profile)
echo "----------"
for filename in "${dotfiles[@]}"; do :
if [ -f ~/$filename ]
then
if [ -h ~/$filename ]; then
echo "~/$filename is already a symlink"
else
echo "~/$filename exists, will not create symlink"
fi
else
echo "~/$filename does not exist, creating symlink to $dotfiles_dir/$filename"
echo "ln -s $dotfiles_dir/$filename ~/$filename"
ln -s $dotfiles_dir/$filename ~/$filename
fi
done
echo "----------"
# uncomment below to view symlinks in home directory
# ls -l `find ~/ -maxdepth 1 -type l -print`
echo "...done"