···11-#!/bin/bash
22-############################
33-# .make.sh
44-# This script creates symlinks from the home directory to any desired dotfiles in ~/dotfiles
55-############################
66-77-########## Variables
88-99-dir=~/dotfiles # dotfiles directory
1010-olddir=~/dotfiles_old # old dotfiles backup directory
1111-files="bashrc vimrc vim zshrc oh-my-zsh" # list of files/folders to symlink in homedir
1212-1313-##########
1414-1515-# create dotfiles_old in homedir
1616-echo "Creating $olddir for backup of any existing dotfiles in ~"
1717-mkdir -p $olddir
1818-echo "...done"
1919-2020-# change to the dotfiles directory
2121-echo "Changing to the $dir directory"
2222-cd $dir
2323-echo "...done"
2424-2525-# move any existing dotfiles in homedir to dotfiles_old directory, then create symlinks
2626-for file in $files; do
2727- echo "Moving any existing dotfiles from ~ to $olddir"
2828- mv ~/.$file ~/dotfiles_old/
2929- echo "Creating symlink to $file in home directory."
3030- ln -s $dir/$file ~/.$file
3131-done