diff options
author | Blaise Thompson <blaise@untzag.com> | 2017-07-21 12:23:00 -0500 |
---|---|---|
committer | Blaise Thompson <blaise@untzag.com> | 2017-07-21 12:23:00 -0500 |
commit | 6631c2608980b429cfa0ba23e08d39ed330a9a56 (patch) | |
tree | 1e6180ef732d9ffa26d9dc911c85a6429f802160 /makesymlinks.sh | |
parent | 382ae229a794a5a803b50c9750f72e74b3eb23e5 (diff) |
license
Diffstat (limited to 'makesymlinks.sh')
-rw-r--r-- | makesymlinks.sh | 31 |
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 |