.dotfiles/symlink.sh

33 lines
692 B
Bash
Executable File

#!/bin/bash
# <relative location to $PWD>:<absolute path of link>
# '~' will be expanded to $HOME
LINKS="
alacritty/alacritty.yml:~/alacritty.yml
bash/bashrc:~/.bashrc
bash/bash_login:~/.bash_login
bash/bash_logout:~/.bash_logout
bash/bash_profile:~/.bash_profile
nvim:~/.config/nvim
vim/vimrc:~/.vimrc
fonts:~/.fonts
icons:~/.icons
"
SUDO="
"
for i in $LINKS; do
DEST=$PWD/$(echo "${i}" | cut -d: -f1)
LINK=$(echo "$i" | cut -d: -f2 | sed -E "s#~#$HOME#")
CMD="ln -s $DEST $LINK"
eval "$CMD"
done
for i in $SUDO; do
DEST=$PWD/$(echo "${i}" | cut -d: -f1)
LINK=$(echo "$i" | cut -d: -f2 | sed -E "s#~#$HOME#")
CMD="sudo ln -s $DEST $LINK"
eval "$CMD"
done