sunhat/install/dotfiles.sh
David Heinemeier Hansson f3b60cfe9d Link all the dotfiles
2024-05-25 19:28:50 -07:00

20 lines
413 B
Bash

# Ensure .config exists
mkdir -p ~/.config
# Link all dotfiles
for entry in dotfiles/*; do
if [ -f "$entry" ]; then
target=~/"$(basename "$entry")"
[ -e "$target" ] && mv "$target" "$target.bak"
ln -s "$(pwd)/$entry" "$target"
fi
if [ -d "$entry" ]; then
target=~/.config/"$(basename "$entry")"
[ -e "$target" ] && mv "$target" "$target.bak"
ln -s "$(pwd)/$entry" "$target"
fi
done
unset entry