From f3b60cfe9d28708aeb40a2821917ba63f5623333 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sat, 25 May 2024 19:28:50 -0700 Subject: [PATCH] Link all the dotfiles --- install/dotfiles.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 install/dotfiles.sh diff --git a/install/dotfiles.sh b/install/dotfiles.sh new file mode 100644 index 0000000..4cad1f4 --- /dev/null +++ b/install/dotfiles.sh @@ -0,0 +1,19 @@ +# 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