Explain linking and .bak

This commit is contained in:
David Heinemeier Hansson 2024-05-25 19:46:14 -07:00
parent 336f041e27
commit 40bdd9660e

View File

@ -3,12 +3,16 @@ mkdir -p ~/.config
# Link all dotfiles
for entry in dotfiles/*; do
# Link all root files as .file in ~/
# Any existing files will be renamed .bak
if [ -f "$entry" ]; then
target=~/"$(basename "$entry")"
target=~/."$(basename "$entry")"
[ -e "$target" ] && mv "$target" "$target.bak"
ln -s "$(pwd)/$entry" "$target"
fi
# Link all directories in ~/.config/
# Any existing directories will be renamed .bak
if [ -d "$entry" ]; then
target=~/.config/"$(basename "$entry")"
[ -e "$target" ] && mv "$target" "$target.bak"