summaryrefslogtreecommitdiff
path: root/makesymlinks.sh
diff options
context:
space:
mode:
Diffstat (limited to 'makesymlinks.sh')
-rw-r--r--makesymlinks.sh31
1 files changed, 31 insertions, 0 deletions
diff --git a/makesymlinks.sh b/makesymlinks.sh
new file mode 100644
index 0000000..587edd7
--- /dev/null
+++ b/makesymlinks.sh
@@ -0,0 +1,31 @@
+#!/bin/bash
+############################
+# .make.sh
+# This script creates symlinks from the home directory to any desired dotfiles in ~/dotfiles
+############################
+
+########## Variables
+
+dir=~/dotfiles # dotfiles directory
+olddir=~/dotfiles_old # old dotfiles backup directory
+files="" # list of files/folders to symlink in homedir
+
+##########
+
+# create dotfiles_old in homedir
+echo -n "Creating $olddir for backup of any existing dotfiles in ~ ..."
+mkdir -p $olddir
+echo "done"
+
+# change to the dotfiles directory
+echo -n "Changing to the $dir directory ..."
+cd $dir
+echo "done"
+
+# move any existing dotfiles in homedir to dotfiles_old directory, then create symlinks from the homedir to any files in the ~/dotfiles directory specified in $files
+for file in $files; do
+ echo "Moving any existing dotfiles from ~ to $olddir"
+ mv ~/.$file ~/dotfiles_old/
+ echo "Creating symlink to $file in home directory."
+ ln -s $dir/$file ~/.$file
+done