Created
February 12, 2020 19:09
-
-
Save mrbongiolo/f6ad1f27b089632a5c4c693ba186e140 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Ripped off from: https://askubuntu.com/a/41950 | |
if [ ! -d ~/.config ]; then | |
mkdir ~/.config | |
fi | |
if [ ! -d ~/.config/nvim ]; then | |
mkdir ~/.config/nvim | |
fi | |
#Array of <source><space><link> target->symlink mappings | |
#linkarray=( "~/Dropbox/systems/solus/home/bash ~/.bash" | |
# "~/Dropbox/systems/solus/home/.bashrc ~/.bashrc" | |
# "~/Dropbox/systems/solus/home/.bash_aliases ~/.bash_aliases" | |
# "~/Dropbox/systems/solus/home/.bash_logout ~/.bash_logout" | |
# "~/Dropbox/systems/solus/home/.bash_profile ~/.bash_profile" | |
# "~/Dropbox/systems/solus/home/.dircolors ~/.dircolors" | |
# "~/Dropbox/systems/solus/home/.gitconfig ~/.gitconfig" | |
# "~/Dropbox/systems/solus/home/.inputrc ~/.inputrc" | |
# "~/Dropbox/systems/solus/home/.profile ~/.profile" | |
# "~/Dropbox/systems/solus/home/nvim/init.vim ~/.config/nvim/init.vim" | |
# "~/Dropbox/systems/solus/home/nvim/autoload ~/.config/nvim/autoload" | |
# "~/Dropbox/systems/solus/home/nvim/colors ~/.config/nvim/colors" | |
# "~/Dropbox/systems/solus/home/ssh ~/.ssh" | |
# "~/Dropbox/systems/solus/home/git_template ~/.git_template" | |
# "~/Dropbox/systems/solus/home/bin ~/bin" ) | |
linkarray=( "~/Dropbox/systems/solus/home/.zshrc ~/.zshrc" | |
"~/Dropbox/systems/solus/home/.dircolors ~/.dircolors" | |
"~/Dropbox/systems/solus/home/.gitconfig ~/.gitconfig" | |
"~/Dropbox/systems/solus/home/.inputrc ~/.inputrc" | |
"~/Dropbox/systems/solus/home/.profile ~/.profile" | |
"~/Dropbox/systems/solus/home/nvim/init.vim ~/.config/nvim/init.vim" | |
"~/Dropbox/systems/solus/home/nvim/autoload ~/.config/nvim/autoload" | |
"~/Dropbox/systems/solus/home/nvim/colors ~/.config/nvim/colors" | |
"~/Dropbox/systems/solus/home/ssh ~/.ssh" | |
"~/Dropbox/systems/solus/home/bin ~/bin" ) | |
#turn off globbing to split each entry on spaces | |
set -f | |
for entry in "${linkarray[@]}" | |
do | |
targets=( $entry ) | |
#eval will expand the tildes | |
eval from=${targets[0]} | |
eval to=${targets[1]} | |
#if the target exists and is not a symlink, err on the side of caution | |
if [ -e "$to" -a ! -L "$to" ] | |
then | |
echo "$to exists and is not a link, skipping..." | |
else | |
#probably safe to delete an existing symlink | |
if [ -e "$to" ] | |
then | |
rm $to | |
fi | |
ln -s $from $to | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment